Skip to content

Latest commit

 

History

History
 
 

bench

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

tl;dr

I get asked all the time to compare restify and express. Here's a trivial "microbenchmark" of restify 1.4.4, restify 2.0.0 and express 3.0.5. In all honesty, I think this is not tremendously useful, as ab is notoriously unreliable, and in particular, both restify and express will let you build a fast application, and in the real world you are far more likely to be I/O bound.

That said, we can clearly see a massive throughput gain in restify 2.0 over 1.4. The latency profile is very similar in all three tests cases, which is expected (i.e., it's driven by node).

Sample code

Simple ability to switch between restify/express:

var server = require('restify').createServer();
//var server = require('express')();

server.get('/echo/:name', function (req, res, next) {
    res.setHeader('content-type', 'text/plain');
    res.send(200, req.params.name);
});

server.listen(8080, function () {
    console.log('ready');
});

Note there is no use of the cluster api, so in all cases we expect to (easily) overwhelm the V8 event thread.

Command

All tests were run using node 0.8.15 on SmartOS in a VMWare VM, and each set was run at least 3 times; outliers were discarded, and the "average" of each test run was recorded below.

Just using ab on localhost, the results of the following command were tracked at varying concurrency levels:

$ ab -k -c N -n 50000 http://127.0.0.1:8080/echo/mark

Only RPS and P99 latency was tracked (mean, median and average are mostly useless in the real world).

Results

Restify 1.4.4

Concurrency Requests/Second P99 Latency (ms)
10 3806.33 5
50 3842.84 22
100 3850.95 34
500 3707.68 158
1000 3560.86 3564

Restify 2.0.0

Concurrency Requests/Second P99 Latency (ms)
10 6293.61 2
50 6249.21 12
100 6073.08 20
500 5653.52 105
1000 5657.44 3490

Express 3.0.5

Concurrency Requests/Second P99 Latency (ms)
10 6057.91 3
50 5781.69 11
100 5533.35 24
500 5300.36 114
1000 5261.26 3512