3
3
[ ![ Build Status] ( https://travis-ci.org/godaddy/node-cluster-service.png )] ( https://travis-ci.org/godaddy/node-cluster-service ) [ ![ NPM version] ( https://badge.fury.io/js/cluster-service.png )] ( http://badge.fury.io/js/cluster-service ) [ ![ Dependency Status] ( https://gemnasium.com/godaddy/node-cluster-service.png )] ( https://gemnasium.com/godaddy/node-cluster-service ) [ ![ Bitdeli Badge] ( https://d2weczhvl823v0.cloudfront.net/godaddy/node-cluster-service/trend.png )] ( https://bitdeli.com/free " Bitdeli Badge ")
4
4
5
5
6
+
6
7
## Install
7
8
8
9
npm install cluster-service
9
10
10
11
https://npmjs.org/package/cluster-service
11
12
12
13
14
+
13
15
## About
14
16
15
17
The short answer:
@@ -35,6 +37,7 @@ Stability:
35
37
with either a deprecation schedule, or documented as a breaking change if necessary.
36
38
37
39
40
+
38
41
## Getting Started
39
42
40
43
Turning your single process node app/service into a fault-resilient multi-process service with all of the bells and whistles has never been easier!
@@ -99,6 +102,7 @@ You can even pipe raw JSON, which can be processed by the caller:
99
102
Check out *** Cluster Commands*** for more details.
100
103
101
104
105
+
102
106
## Start Options
103
107
104
108
When initializing your service, you have a number of options available:
@@ -151,6 +155,8 @@ Or within your node app:
151
155
extension. If the module exposes the "id" property, that will be the name of the command,
152
156
otherwise the filename (minus the extension) will be used as the name of the command. If relative
153
157
paths are provided, they will be resolved from process.cwd().
158
+ * ` servers ` - One (object) or more (array of objects) ` Net ` objects to listen for *** Net Stats*** .
159
+
154
160
155
161
156
162
## Console & REST API
@@ -193,6 +199,7 @@ Commands may be disabled by overriding them.
193
199
* ` upgrade all|pid workerPath { [cwd] [timeout:60] } ` - Gracefully upgrade service, one worker at a time. (continuous deployment support).
194
200
* ` workers ` - Returns list of active worker processes.
195
201
* ` health ` - Returns health of service. Can be overidden by service to expose app-specific data.
202
+ * ` info ` - Returns summary of process & workers.
196
203
197
204
198
205
@@ -256,7 +263,7 @@ Additionally, a worker may optionally perform cleanup tasks prior to exit, via:
256
263
## Access Control
257
264
258
265
Commands may be granted "inproc" (high risk), "local" (low risk), or "remote" (no risk). Setting
259
- access control at compile time can be done within the command, like so:
266
+ access control can be done within the command, like so:
260
267
261
268
``` javascript
262
269
// exit.js
@@ -291,6 +298,24 @@ different location. This capability is still a work in progress, but initial tes
291
298
* Upgrade reports success
292
299
293
300
301
+
302
+ ## Net Stats
303
+
304
+ As of v0.8, you may optionally collect network statistics within cservice. To enable this feature,
305
+ you must provide all Net object servers (tcp, http, https, etc) in one of two ways:
306
+
307
+ var server = require("http").createServer(onRequest);
308
+ require("cluster-service").netStats(server); // listen to net stats
309
+
310
+ Or you can provide the net server objects via the ``` servers ``` option:
311
+
312
+ var server = require("http").createServer(onRequest);
313
+ require("cluster-service").workerReady({ servers: [ server] }); // listen to net stats
314
+
315
+ Net statistics summary may be found via the ``` info ``` command, and individual process
316
+ net statistics may be found via the ``` workers ``` command.
317
+
318
+
294
319
295
320
## Tests & Code Coverage
296
321
0 commit comments