Skip to content

Commit 296d627

Browse files
committed
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: #20876
1 parent 110aa38 commit 296d627

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

doc/api/cluster.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
77
<!-- source_link=lib/cluster.js -->
88

9-
A single instance of Node.js runs in a single thread. To take advantage of
10-
multi-core systems, the user will sometimes want to launch a cluster of Node.js
11-
processes to handle the load.
9+
Clusters of Node.js processes can be used to run multiple instances of Node.js
10+
that can distribute workloads among their application threads. When process
11+
isolation is not needed, the newer [worker threads][] module can be used
12+
instead, which allows running multiple application threads within a single
13+
Node.js instance.
1214

1315
The cluster module allows easy creation of child processes that all share
1416
server ports.
@@ -1109,6 +1111,7 @@ socket.on('data', (id) => {
11091111

11101112
[Advanced serialization for `child_process`]: child_process.md#advanced-serialization
11111113
[Child Process module]: child_process.md#child_processforkmodulepath-args-options
1114+
[worker threads]: worker_threads.md
11121115
[`.fork()`]: #clusterforkenv
11131116
[`.setupPrimary()`]: #clustersetupprimarysettings
11141117
[`ChildProcess.send()`]: child_process.md#subprocesssendmessage-sendhandle-options-callback

0 commit comments

Comments
 (0)