diff options
author | isaacs <i@izs.me> | 2012-02-27 23:07:49 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-03-01 03:24:27 +0400 |
commit | 6738d82e38e9f47df953f80dd9a30311afd152f7 (patch) | |
tree | b33fefcf9b60534d9c758897aa140a96aed32f16 /doc/api | |
parent | 03d6aa07ea8d267adb2101b333849251d45dd134 (diff) |
doc refactor: cluster
Diffstat (limited to 'doc/api')
-rw-r--r-- | doc/api/cluster.markdown | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/doc/api/cluster.markdown b/doc/api/cluster.markdown index 7f1b19c69fa..39e9444d1fe 100644 --- a/doc/api/cluster.markdown +++ b/doc/api/cluster.markdown @@ -1,4 +1,4 @@ -## Cluster +# 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 @@ -72,18 +72,18 @@ in the master process via message passing: -### cluster.fork() +## cluster.fork() Spawn a new worker process. This can only be called from the master process. -### cluster.isMaster -### cluster.isWorker +## cluster.isMaster +## cluster.isWorker Boolean flags to determine if the current process is a master or a worker process in a cluster. A process `isMaster` if `process.env.NODE_WORKER_ID` is undefined. -### Event: 'death' +## Event: 'death' When any of the workers die the cluster module will emit the 'death' event. This can be used to restart the worker by calling `fork()` again. @@ -92,6 +92,6 @@ This can be used to restart the worker by calling `fork()` again. console.log('worker ' + worker.pid + ' died. restart...'); cluster.fork(); }); - + Different techniques can be used to restart the worker depending on the application. |