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

multiple wasmer processes created? #4113

Open
matsbror opened this issue Jul 28, 2023 · 2 comments
Open

multiple wasmer processes created? #4113

matsbror opened this issue Jul 28, 2023 · 2 comments
Labels
📦 lib-cli About wasmer-cli 📦 lib-wasi About wasmer-wasi priority-medium Medium priority issue ❓ question I've a question!
Milestone

Comments

@matsbror
Copy link

Summary

I have built the command line tool from source and am trying to benchmark performance. Startup time seems to be very slow and increasing with the number of processors in the system. How can I force wasmer to only use one core?

Additional details

Provide any additional details here.

@matsbror matsbror added the ❓ question I've a question! label Jul 28, 2023
@Michael-F-Bryan
Copy link
Contributor

This may be because we use a rayon threadpool, and on first use, that threadpool will start up a number of threads proportional to the number of cores on the machine. If so, you might be able to swap out the wasmer_wasix::runtime::task_manager::TokioTaskManager for a different implementation.

@Michael-F-Bryan Michael-F-Bryan added 📦 lib-wasi About wasmer-wasi 📦 lib-cli About wasmer-cli priority-medium Medium priority issue labels Aug 1, 2023
@Michael-F-Bryan Michael-F-Bryan added this to the v4.x milestone Aug 1, 2023
@hishamhm
Copy link

I seem to be running into the same issue — we're running Wasmer inside Nginx, which already employs a process pool model, and spawns N forks for N processors. Running Wasmer 4 is giving us N*N forks, with the complicating factor that the threads do not seem to be terminated when we do wasm_engine_delete (we're embedding via the Wasm C API so our customization options are limited).

I found this comment in the Rayon repository which looks concerning: "I suspect this is simply due to the fact that we never shutdown the global thread pool, by design. See also rayon-rs/rayon#688", and that Rayon issue is still open: "Consider adding an easier way of synchronously shutting down a thread-pool".

The end-result is that when I run our test suite, which starts a Wasm engine per test, I end up with thousands of threads spawned, which brings the system to a crawl and, most impactfully, breaks running tests under Valgrind: https://github.com/Kong/ngx_wasm_module/actions/runs/6164685265/job/16730923753?pr=413

This is preventing us from upgrading to the latest Wasmer (which we need to because of #4058).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 lib-cli About wasmer-cli 📦 lib-wasi About wasmer-wasi priority-medium Medium priority issue ❓ question I've a question!
Projects
None yet
Development

No branches or pull requests

4 participants