Commit Graph

42 Commits (ff0de45929ab130bec268097c46a1047aba29825)

Author SHA1 Message Date
isaacs 22c7d134e2 lint 2013-04-11 11:06:20 -07:00
Ben Noordhuis dbbfbe74ca cluster: fix O(n*m) scan of cmd string
Don't scan the whole string for a "NODE_CLUSTER_" substring, just check
that the string starts with the expected prefix. The linear scan was
causing a noticeable (but unsurprising) slowdown on messages with a
large .cmd string property.
2013-04-11 13:42:34 +02:00
isaacs e428bb7eae cluster: Rename destroy() to kill(signal=SIGTERM)
Fix #4133, bringing the cluster worker API more in line with the
child process API.
2013-03-03 17:26:38 -08:00
Bert Belder 5e7e51c2fe cluster: support datagram sockets 2013-01-28 22:12:21 +01:00
Ben Noordhuis 6b713b5253 cluster: make --prof work for workers
Profiling in clustered environments doesn't work out of the box.

By default, V8 writes the profile data of all processes to a single
v8.log.

Running that log file through a tick processor produces bogus numbers
because many events won't match up with the recorded memory mappings
and you end up with graphs where 80+% of ticks is unaccounted for.

Fixing the tick processor to deal with multi-process output is not very
useful because the processes may be running wildly disparate workloads.

That's why we fix up the command line arguments to include
a "--logfile=v8-%p.log" argument (where %p is expanded to the PID)
unless it already contains a --logfile argument.

Fixes #4617.
2013-01-18 12:56:40 +01:00
Aaditya Bhatia c668185add cluster: make 'listening' handler see actual port
Make the 'listening' event handler in the master process see the actual port
that the worker bound to when the worker specified port 0, i.e. a random port.
2012-10-09 16:23:24 +02:00
Ben Noordhuis 4c150ca0d0 net: fix listen() regression, revert patches
This commit reverts the following commits (in reverse chronological order):

  74d076c errnoException must be done immediately
  ddb02b9 net: support Server.listen(Pipe)
  085a098 cluster: do not use internal server API
  d138875 net: lazy listen on handler

Commit d138875 introduced a backwards incompatible change that broke the
simple/test-net-socket-timeout and simple/test-net-lazy-listen tests - it
defers listening on the target port until the `net.Server` instance has at
least one 'connection' event listener.

The other patches had to be reverted in order to revert d138875.

Fixes #3832.
2012-08-06 23:55:38 +02:00
Andreas Madsen 085a09874b cluster: do not use internal server API 2012-08-05 13:53:31 -07:00
Jonas Westerlund 93d4259cf0 Avoid redeclaring variable
Capitalize the constructor to avoid redeclaration.
Fixes strict mode error.
2012-07-06 19:28:35 -07:00
Andreas Madsen 1e0ce5d1bd domain: the EventEmitter constructor is now always called in nodecore 2012-06-15 09:49:05 -07:00
Andreas Madsen c2c08196d8 cluster: rename worker.unqiueID to worker.id 2012-06-14 09:32:56 -07:00
isaacs e733dc3bc3 Fix #3388 Support listening on file descriptors
This implements server.listen({ fd: <filedescriptor> }).  The fd should
refer to an underlying resource that is already bound and listening, and
causes the new server to also accept connections on it.

Not supported on Windows.  Raises ENOTSUP.
2012-06-13 12:24:45 -07:00
Andreas Madsen 81a4edcf6a cluster: remove NODE_UNIQUE_ID from env on startup
In case a worker would spawn a new subprocess with process.env, NODE_UNIQUE_ID
would have been a part of the env. Making the new subprocess believe it is a
worker, this would result in some confusion if the subprocess where to listen to
a port, since the server handle request would then be relayed to the worker.

This patch removes the NODE_UNIQUE_ID flag from process.env on startup so any
subprocess spawned by a worker is a normal process with no cluster stuff.
2012-05-21 23:27:44 +02:00
isaacs 3d84c3db25 More cluster event consistency
Regarding discussion in #3198.  Passing the worker as an argument
to an event emitted on the worker is redundant, and an unnecessary
break in consistency vs the events on the ChildProcess objects.

It was removed from 'exit', but 'listening' and others were
overlooked.  This corrects that oversight.
2012-05-05 15:20:10 -07:00
J. Lee Coltrane a62dd44b20 cluster: worker exit event to match child_process
test: fixes due to new cluster api.

- changed worker `death` to `exit`.
- corrected argument type expected by worker `exit` handler.

test: more tests of cluster.worker death

cluster: fixed arguments on worker 'exit' event

worker 'exit' event now emits arguments consistent with the
corresponding event in child_process module.
2012-05-04 17:28:21 -07:00
Zachary Scott d73b257d65 docs: grammar and spelling on lib/cluster.js 2012-04-06 01:44:03 +02:00
isaacs 90ce5b3d41 cluster: Rename 'death' back to 'exit' 2012-03-30 12:59:24 -07:00
isaacs dce8682827 cluster: English language fixing 2012-03-19 14:28:39 -07:00
Andreas Madsen 94d337eb0f cluster: kill workers when master dies
This patch will kill the worker once it has lost its connection with the parent.
However if the worker are doing a suicide, other measures will be used.
2012-03-19 14:22:36 -07:00
Andreas Madsen d927fbc9ab cluster: add graceful disconnect support
This patch add a worker.disconnect() method there will stop the worker from accepting
new connections and then stop the IPC. This allow the worker to die graceful.
When the IPC has been disconnected a 'disconnect' event will emit.

The patch also add a cluster.disconnect() method, this will call worker.disconnect() on
all connected workers. When the workers are disconneted it will then close all server
handlers. This allow the cluster itself to self terminate in a graceful way.
2012-03-19 13:29:01 -07:00
Micheil Smith 19fd5301bf Expose original argv as process.execArgv for cluster and child_process.fork() 2012-03-15 13:47:43 -07:00
Maciej Małecki c6c6f98f1c util: add `util._extend` for extending objects
There were 2 duplicates with such functionality in `cluster` and
`child_process` modules which were replaced by this function.
2012-02-20 21:58:00 +01:00
isaacs 0cdf85e28d Lint all the JavaScripts. 2012-02-18 15:34:57 -08:00
Andreas Madsen 1595a6e885 cluster: use process.disconnect method
After adding a .disconect method and connected flag in child_process
we should no longer use the process._channel object.
2012-02-06 14:54:11 -08:00
Andreas Madsen a20872045a cluster: simplify process event handling
This simplify the internalMessage and exit event handling
And simply relay message and error event to the worker object
Note that the error event was not relayed before
2012-02-06 14:54:11 -08:00
Andreas Madsen f9a47debfc Add cluster.setupMaster
Fixes #2470
2012-01-20 13:09:56 -08:00
Andreas Madsen c8108aad83 child_process: fix typo in internal message event name 2012-01-11 09:59:50 +01:00
Andreas Madsen e2f1e50c60 typos
fixes #2465
2012-01-05 00:31:49 -08:00
Andreas Madsen 5f08c3cfa1 cluster improvements: Worker class and isolate internal messages
Fixes #2388
2012-01-04 18:30:19 -08:00
Andreas Madsen 3966e4e7a5 Remove debug console.log and optimize object copy
Fixes #2380
2011-12-19 13:25:19 -08:00
Andreas Madsen 07b1997388 Add env argument to cluster.fork
Fixes 2378
2011-12-19 12:34:59 -08:00
Andreas Madsen a599aeb2a8 jslint
Fixes #2306
2011-12-16 12:57:03 -08:00
Ryan Dahl 4e2343c6b5 Fixes #2073. Cluster should be silent. 2011-11-11 11:24:59 -08:00
Ryan Dahl 0fa3cf94a3 Remove 'report this bug' message from cluster master 2011-11-08 17:07:49 -08:00
Ryan Dahl da9bf0ee80 Fixes #2047. Fill workers array immediately after fork 2011-11-08 17:03:29 -08:00
Ben Noordhuis 105d1787dc cluster: fix call to undefined function 2011-11-08 08:29:25 +01:00
Ryan Dahl d42006c80a cluster: Remove eachWorker, workerCount
unnecessary
2011-11-04 15:14:38 -07:00
Ryan Dahl 86528489ec new cluster api 2011-11-04 15:12:11 -07:00
Bert Belder 189dd8f803 Fix line endings and trailing whitespace 2011-11-04 16:24:34 +01:00
Tj Holowaychuk 528c28587f cluster: Add some docs, improve cluster.isWorker()
Fixes #1949.
2011-10-26 16:42:00 -07:00
Ryan Dahl c5d54010bc node cluster is now a module instead of CLI interface
This is to make room for master process plugins instead of adding CLI
options as proposed in #1879.
2011-10-26 13:50:53 -07:00
Ryan Dahl 87339a22b1 introduce node cluster 2011-10-12 02:58:35 -07:00