Last active
November 10, 2016 11:22
-
-
Save ikouchiha47/7ab1f0ebe383c679ce2e74549894a8d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`node --nouse-idle-notification --expose-gc --max-old-space-size=8192 testserver.js` | |
This is ApacheBench, Version 2.3 <$Revision: 1706008 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking localhost (be patient).....done | |
Server Software: | |
Server Hostname: localhost | |
Server Port: 8890 | |
Document Path: / | |
Document Length: 25 bytes | |
Concurrency Level: 1 | |
Time taken for tests: 0.078 seconds | |
Complete requests: 10 | |
Failed requests: 0 | |
Total transferred: 1000 bytes | |
HTML transferred: 250 bytes | |
Requests per second: 128.23 [#/sec] (mean) | |
Time per request: 7.798 [ms] (mean) | |
Time per request: 7.798 [ms] (mean, across all concurrent requests) | |
Transfer rate: 12.52 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 0 0.1 0 0 | |
Processing: 1 8 7.8 4 20 | |
Waiting: 1 5 5.0 4 13 | |
Total: 1 8 7.8 4 20 | |
Percentage of the requests served within a certain time (ms) | |
50% 4 | |
66% 7 | |
75% 16 | |
80% 19 | |
90% 20 | |
95% 20 | |
98% 20 | |
99% 20 | |
100% 20 (longest request) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cluster = require('cluster'); | |
var http = require('http'); | |
if(cluster.isMaster) { | |
var numWorkers = require('os').cpus().length; | |
console.log('Master cluster setting up ' + numWorkers + ' workers...'); | |
for(var i = 0; i < numWorkers; i++) { | |
cluster.fork(); | |
} | |
cluster.on('online', function(worker) { | |
console.log('Worker ' + worker.process.pid + ' is online'); | |
}); | |
cluster.on('exit', function(worker, code, signal) { | |
console.log('Worker ' + worker.process.pid + ' died with code: ' + code + ', and signal: ' + signal); | |
console.log('Starting a new worker'); | |
cluster.fork(); | |
}); | |
} else { | |
http.createServer(function(req, res) { | |
res.writeHead(200); | |
res.end('process ' + process.pid + ' says hello!'); | |
}).listen(8890); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment