Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Add some docs for node cluster
  • Loading branch information
ry committed Oct 12, 2011
1 parent 08cb8fc commit de7fb33
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/api/_toc.markdown
Expand Up @@ -32,6 +32,7 @@
* [ZLIB](zlib.html)
* [OS](os.html)
* [Debugger](debugger.html)
* [Cluster](cluster.html)
* Appendixes
* [Appendix 1: Recommended Third-party Modules](appendix_1.html)
* [Appendix 2: Deprecated API's](appendix_2.html)
23 changes: 23 additions & 0 deletions doc/api/cluster.markdown
@@ -0,0 +1,23 @@
## Cluster

A single instance of Node runs in a single thread. To take advantage of
multi-core systems the user will sometimes want to launch a cluster of Node
processes to handle the load.

By starting node with the `cluster` argument, Node will detect the number of
CPUs on the machine and start that many processes. For example suppose we
had a simple HTTP server in server.js:

require('http').createServer(function(req, res) {
res.writeHead(200);
res.end('hello world\n');
}).listen(8000);

If we start it like this

% node cluster server.js
Detected 2 cpus
Worker 2438 online
Worker 2437 online

Node will automatically share port 8000 between the multiple instances.

0 comments on commit de7fb33

Please sign in to comment.