Test code from http://stackoverflow.com/questions/17589178/why-should-i-use-restify
Last active
April 18, 2016 07:07
-
-
Save CatTail/5b903e0bbf44501ba2f06d24c0f3f010 to your computer and use it in GitHub Desktop.
Benchmark for expressjs and restify
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
#! /bin/bash | |
ab -n 10000 -c 100 http://127.0.0.1:3000/ |
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 express = require('express'); | |
var app = express(); | |
app.get('/hello/:name', function(req, res){ | |
res.send('hello ' + req.params.name); | |
}); | |
app.listen(3000); | |
console.log('Listening on port 3000'); |
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
This is ApacheBench, Version 2.3 <$Revision: 1528965 $> | |
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 1000 requests | |
Completed 2000 requests | |
Completed 3000 requests | |
Completed 4000 requests | |
Completed 5000 requests | |
Completed 6000 requests | |
Completed 7000 requests | |
Completed 8000 requests | |
Completed 9000 requests | |
Completed 10000 requests | |
Finished 10000 requests | |
Server Software: | |
Server Hostname: 127.0.0.1 | |
Server Port: 3000 | |
Document Path: / | |
Document Length: 13 bytes | |
Concurrency Level: 100 | |
Time taken for tests: 1.414 seconds | |
Complete requests: 10000 | |
Failed requests: 0 | |
Non-2xx responses: 10000 | |
Total transferred: 2110000 bytes | |
HTML transferred: 130000 bytes | |
Requests per second: 7071.69 [#/sec] (mean) | |
Time per request: 14.141 [ms] (mean) | |
Time per request: 0.141 [ms] (mean, across all concurrent requests) | |
Transfer rate: 1457.16 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 0 0.1 0 2 | |
Processing: 8 14 4.3 12 45 | |
Waiting: 8 14 4.3 12 45 | |
Total: 10 14 4.4 12 46 | |
Percentage of the requests served within a certain time (ms) | |
50% 12 | |
66% 14 | |
75% 15 | |
80% 15 | |
90% 18 | |
95% 22 | |
98% 30 | |
99% 36 | |
100% 46 (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
{ | |
"name": "5b903e0bbf44501ba2f06d24c0f3f010", | |
"version": "1.0.0", | |
"description": "Benchmark for expressjs and restify", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"repository": { | |
"type": "git", | |
"url": "git+ssh://[email protected]/5b903e0bbf44501ba2f06d24c0f3f010.git" | |
}, | |
"author": "[email protected]", | |
"license": "MIT", | |
"bugs": { | |
"url": "https://gist.github.com/5b903e0bbf44501ba2f06d24c0f3f010" | |
}, | |
"homepage": "https://gist.github.com/5b903e0bbf44501ba2f06d24c0f3f010", | |
"dependencies": { | |
"express": "^4.13.4", | |
"restify": "^4.0.4" | |
} | |
} |
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 restify = require('restify'); | |
var server = restify.createServer(); | |
server.get('/hello/:name', function(req, res, next) { | |
res.send('hello ' + req.params.name); | |
}); | |
server.listen(3000, function() { | |
console.log('Listening on port 3000'); | |
}); |
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
This is ApacheBench, Version 2.3 <$Revision: 1528965 $> | |
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 1000 requests | |
Completed 2000 requests | |
Completed 3000 requests | |
Completed 4000 requests | |
Completed 5000 requests | |
Completed 6000 requests | |
Completed 7000 requests | |
Completed 8000 requests | |
Completed 9000 requests | |
Completed 10000 requests | |
Finished 10000 requests | |
Server Software: | |
Server Hostname: 127.0.0.1 | |
Server Port: 3000 | |
Document Path: / | |
Document Length: 56 bytes | |
Concurrency Level: 100 | |
Time taken for tests: 1.886 seconds | |
Complete requests: 10000 | |
Failed requests: 0 | |
Non-2xx responses: 10000 | |
Total transferred: 1900000 bytes | |
HTML transferred: 560000 bytes | |
Requests per second: 5301.51 [#/sec] (mean) | |
Time per request: 18.863 [ms] (mean) | |
Time per request: 0.189 [ms] (mean, across all concurrent requests) | |
Transfer rate: 983.68 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 0 0.1 0 2 | |
Processing: 16 19 4.6 17 61 | |
Waiting: 16 19 4.6 17 61 | |
Total: 16 19 4.7 17 62 | |
Percentage of the requests served within a certain time (ms) | |
50% 17 | |
66% 18 | |
75% 19 | |
80% 20 | |
90% 21 | |
95% 28 | |
98% 37 | |
99% 42 | |
100% 62 (longest request) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment