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

UV_THREADPOOL_SIZE may not be taking effect #489

Open
vcabbage opened this issue Nov 4, 2020 · 0 comments
Open

UV_THREADPOOL_SIZE may not be taking effect #489

vcabbage opened this issue Nov 4, 2020 · 0 comments

Comments

@vcabbage
Copy link
Contributor

vcabbage commented Nov 4, 2020

While doing load testing of raster tiles I found that by setting the UV_THREADPOOL_SIZE environment variable to the number of threads available on my system I got significantly better scalability. This was somewhat unexpected since server.js already sets it to at least 1.5 times the number of cores.

process.env.UV_THREADPOOL_SIZE =
Math.ceil(Math.max(4, require('os').cpus().length * 1.5));

I haven't found an authoritative reference, but https://gist.github.com/rjoydip/36031b3b6d46a9d638e3a97816d2a137 suggests that "You cannot change the size of the thread pool once it is created or entered in the event-loop/worker-thread."

I moved the block of code referenced above to the top of main.js and saw a similar performance increase as I did when setting UV_THREADPOOL_SIZE externally.

Would it be worth submitting a PR for this change?

As a side note, it might be nice to check if UV_THREADPOOL_SIZE is already set so that the user may set it themselves if desired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant