Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make CodeMap lock-free #1128

Open
Robbepop opened this issue Jul 11, 2024 · 0 comments
Open

Make CodeMap lock-free #1128

Robbepop opened this issue Jul 11, 2024 · 0 comments
Labels
enhancement New feature or request optimization An performance optimization issue. research Research intense work item.

Comments

@Robbepop
Copy link
Member

Robbepop commented Jul 11, 2024

Since #1122 Wasmi's internal CodeMap, that stores all the data of functions stored in the Engine, is put entirely behind a Mutex based lock for all accesses.

Link to code_map.rs: https://github.com/wasmi-labs/wasmi/blob/main/crates/wasmi/src/engine/code_map.rs

Before #1122, it was put behind an RwLock and was read-locked whenever Wasmi exeucted a function which was the root cause for the dead-lock that #1122 has fixed.

The downsides of #1122 is that the performance of call-intense workload have regressed by roughly 5-10% which was acceptable given the importance of fixing the dead-lock.

However, ideally we want a lock-free version of CodeMap with hopefully improved performance, especially for accessing pre-compiled Wasm functions. Access of pre-compiled Wasm functions is part of the hot-path of the Wasmi executor and thus its performance is critical.

An inspiring blog post about a lock-free append-only Vec implementation in Rust:
https://ibraheem.ca/posts/a-lock-free-vector/

This issue is about tracking progress for the lock-free CodeMap implementation.

@Robbepop Robbepop added enhancement New feature or request optimization An performance optimization issue. research Research intense work item. labels Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request optimization An performance optimization issue. research Research intense work item.
Projects
None yet
Development

No branches or pull requests

1 participant