Skip to content

Instantly share code, notes, and snippets.

@lifuzu
Created March 9, 2016 22:30
Show Gist options
  • Save lifuzu/b335ed1ecba285b3c774 to your computer and use it in GitHub Desktop.
Save lifuzu/b335ed1ecba285b3c774 to your computer and use it in GitHub Desktop.
node script to setup a simple hello world web server (http://lifuzu.com/blog/2014/01/05/performance-analysis-of-gevent-eventlet-and-nodejs)
var http=require("http");
http.createServer(function(req,res){
res.writeHead(200,{"Content-Type":"text/plain"});
res.end("Hello World\n");
}).listen(9124,"localhost");
console.log("The sweet thing is running on http://localhost:9124");
@lifuzu
Copy link
Author

lifuzu commented Mar 9, 2016

$ ab -n 1000 -c 100 -r http://127.0.0.1:9124/
This is ApacheBench, Version 2.3 <$Revision: 1663405 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests

Server Software:
Server Hostname: 127.0.0.1
Server Port: 9124

Document Path: /
Document Length: 12 bytes

Concurrency Level: 100
Time taken for tests: 0.225 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 113000 bytes
HTML transferred: 12000 bytes
Requests per second: 4446.05 #/sec
Time per request: 22.492 ms
Time per request: 0.225 [ms](mean, across all concurrent requests)
Transfer rate: 490.63 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 1.2 0 5
Processing: 12 21 8.3 19 50
Waiting: 12 21 8.3 19 50
Total: 13 22 9.1 19 52

Percentage of the requests served within a certain time (ms)
50% 19
66% 21
75% 23
80% 28
90% 35
95% 42
98% 50
99% 52
100% 52 (longest request)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment