mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
doc: suggest worker threads in cluster docs
The current documentation is incorrect in that it says "A single instance of Node.js runs in a single thread," which is not true due to the addition of worker threads. This patch removes the incorrect statement and instead suggests that applications consider using worker threads when process isolation is not needed. Refs: https://github.com/nodejs/node/pull/20876 PR-URL: https://github.com/nodejs/node/pull/41616 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com>
This commit is contained in:
1 parent
ea6c202436
commit
ffab924444
1 file changed
+5
-3
+5
-3
@@ -6,9 +6,10 @@
|
||||
|
||||
<!-- source_link=lib/cluster.js -->
|
||||
|
||||
A single instance of Node.js runs in a single thread. To take advantage of
|
||||
multi-core systems, the user will sometimes want to launch a cluster of Node.js
|
||||
processes to handle the load.
|
||||
Clusters of Node.js processes can be used to run multiple instances of Node.js
|
||||
that can distribute workloads among their application threads. When process
|
||||
isolation is not needed, use the [`worker_threads`][] module instead, which
|
||||
allows running multiple application threads within a single Node.js instance.
|
||||
|
||||
The cluster module allows easy creation of child processes that all share
|
||||
server ports.
|
||||
@@ -1121,3 +1122,4 @@ socket.on('data', (id) => {
|
||||
[`process` event: `'message'`]: process.md#event-message
|
||||
[`server.close()`]: net.md#event-close
|
||||
[`worker.exitedAfterDisconnect`]: #workerexitedafterdisconnect
|
||||
[`worker_threads`]: worker_threads.md
|
||||
Reference in new issue
Block a user