Allow the server to run with multiple workers
See original GitHub issueJavaScript is single-threaded, but Node.js can run an HTTP server with multiple workers such that different HTTP requests are handled independently with different threads.
In order to realize this, we need to:
- write and test code to fire up multiple workers at start-up (https://nodejs.org/api/cluster.html)
- when running in multi-worker mode, log a warning that we are and that there should be no single-threaded components
- set a configuration parameter plus command-line switch for the number of workers
- perhaps provide a global mechanism for single-threaded components that they can register for safety reasons
- e.g., an
ensureSingleThreaded()
which throws if not https://nodejs.org/api/cluster.html#cluster_cluster_ismaster (and perhaps also if not not https://nodejs.org/api/worker_threads.html#worker_threads_worker_ismainthread) - ensure there are multi-threaded alternatives for every currently single-threaded component
- seems to only involve locking: https://github.com/solid/community-server/issues/309
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:28 (28 by maintainers)
Top Results From Across the Web
Running multiple workers using Celery - python - Server Fault
I have now updated my answer following the comment from MartinP regarding worker spawning child processes not threads: Celery worker and worker processes...
Read more >Installing Multiple Workers On the Same Server (Linux) - Support
1. Browse to where the Retain install script is located. · 2. Run the command installer script as follows: ./RetainInstall.sh addworker · 3....
Read more >[RR2] Question: Using multiple workers and supervisor #632
Hey @jwillp . At the moment RR2 supports only 1 server inside it with 1 command to start workers. I guess you can...
Read more >Celery - run different workers on one server - Stack Overflow
I have two Pyramid apps running on the same physical hardware, each with its own celery instance(within their own virtualenvs).
Read more >Django Channels: best way to launch multiple workers
Each server is single-threaded, so it's recommended you run around one or two per core on each machine; it's safe to run as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If we do add the worker metadata to the logger at construction time, then it can be easy to filter it somewhere down the line. Winston log calls accept a third
meta
argument that can be an arbitrary object, so we can store in there what we want and use it for filtering later: https://github.com/winstonjs/winston#filtering-info-objectsPerfect, love it.