Skip to content

Commit 6eb266a

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: nodejs#20876
1 parent 110aa38 commit 6eb266a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

doc/api/cluster.md

+6-3
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.
@@ -1122,3 +1124,4 @@ socket.on('data', (id) => {
11221124
[`process` event: `'message'`]: process.md#event-message
11231125
[`server.close()`]: net.md#event-close
11241126
[`worker.exitedAfterDisconnect`]: #workerexitedafterdisconnect
1127+
[worker threads]: worker_threads.md

0 commit comments

Comments
 (0)