|
| 1 | +# tl;dr |
| 2 | + |
| 3 | +I get asked *all the time* to compare restify and express. Here's a trivial |
| 4 | +"microbenchmark" of restify 1.4.4, restify 2.0.0 and express 3.0.5. In all |
| 5 | +honesty, I think this is not tremendously useful, as `ab` is notoriously |
| 6 | +unreliable, and in particular, both restify and express will let you build a |
| 7 | +fast application, and in the real world you are far more likely to be I/O bound. |
| 8 | + |
| 9 | +That said, we can clearly see a massive throughput gain in restify 2.0 over 1.4. |
| 10 | +The latency profile is very similar in all three tests cases, which is expected |
| 11 | +(i.e., it's driven by node). |
| 12 | + |
| 13 | +# Sample code |
| 14 | + |
| 15 | +Simple ability to switch between restify/express: |
| 16 | + |
| 17 | + var server = require('restify').createServer(); |
| 18 | + //var server = require('express')(); |
| 19 | + |
| 20 | + server.get('/echo/:name', function (req, res, next) { |
| 21 | + res.setHeader('content-type', 'text/plain'); |
| 22 | + res.send(200, req.params.name); |
| 23 | + }); |
| 24 | + |
| 25 | + server.listen(8080, function () { |
| 26 | + console.log('ready'); |
| 27 | + }); |
| 28 | + |
| 29 | +Note there is no use of the `cluster` api, so in all cases we expect |
| 30 | +to (easily) overwhelm the V8 event thread. |
| 31 | + |
| 32 | +# Command |
| 33 | + |
| 34 | +All tests were run using node 0.8.15 on [SmartOS](http://smartos.org/) in a |
| 35 | +VMWare VM, and each set was run at least 3 times; outliers were discarded, |
| 36 | +and the "average" of each test run was recorded below. |
| 37 | + |
| 38 | +Just using `ab` on localhost, the results of the following command |
| 39 | +were tracked at varying concurrency levels: |
| 40 | + |
| 41 | + $ ab -k -c N -n 50000 http://127.0.0.1:8080/echo/mark |
| 42 | + |
| 43 | +Only RPS and P99 latency was tracked (mean, median and average are mostly |
| 44 | +useless in the real world). |
| 45 | + |
| 46 | +# Results |
| 47 | + |
| 48 | +## Restify 1.4.4 |
| 49 | + |
| 50 | +<table> |
| 51 | + <tr> |
| 52 | + <td>Concurrency</td> |
| 53 | + <td>Requests/Second</td> |
| 54 | + <td>P99 Latency (ms)</td> |
| 55 | + </tr> |
| 56 | + <tr> |
| 57 | + <td>10</td> |
| 58 | + <td>3806.33</td> |
| 59 | + <td>5</td> |
| 60 | + </tr> |
| 61 | + <tr> |
| 62 | + <td>50</td> |
| 63 | + <td>3842.84</td> |
| 64 | + <td>22</td> |
| 65 | + </tr> |
| 66 | + <tr> |
| 67 | + <td>100</td> |
| 68 | + <td>3850.95</td> |
| 69 | + <td>34</td> |
| 70 | + </tr> |
| 71 | + <tr> |
| 72 | + <td>500</td> |
| 73 | + <td>3707.68</td> |
| 74 | + <td>158</td> |
| 75 | + </tr> |
| 76 | + <tr> |
| 77 | + <td>1000</td> |
| 78 | + <td>3560.86</td> |
| 79 | + <td>3564</td> |
| 80 | + </tr> |
| 81 | +</table> |
| 82 | + |
| 83 | +## Restify 2.0.0 |
| 84 | + |
| 85 | +<table> |
| 86 | + <tr> |
| 87 | + <td>Concurrency</td> |
| 88 | + <td>Requests/Second</td> |
| 89 | + <td>P99 Latency (ms)</td> |
| 90 | + </tr> |
| 91 | + <tr> |
| 92 | + <td>10</td> |
| 93 | + <td>6293.61</td> |
| 94 | + <td>2</td> |
| 95 | + </tr> |
| 96 | + <tr> |
| 97 | + <td>50</td> |
| 98 | + <td>6249.21</td> |
| 99 | + <td>12</td> |
| 100 | + </tr> |
| 101 | + <tr> |
| 102 | + <td>100</td> |
| 103 | + <td>6073.08</td> |
| 104 | + <td>20</td> |
| 105 | + </tr> |
| 106 | + <tr> |
| 107 | + <td>500</td> |
| 108 | + <td>5653.52</td> |
| 109 | + <td>105</td> |
| 110 | + </tr> |
| 111 | + <tr> |
| 112 | + <td>1000</td> |
| 113 | + <td>5657.44</td> |
| 114 | + <td>3490</td> |
| 115 | + </tr> |
| 116 | +</table> |
| 117 | + |
| 118 | + |
| 119 | +## Express 3.0.5 |
| 120 | + |
| 121 | +<table> |
| 122 | + <tr> |
| 123 | + <td>Concurrency</td> |
| 124 | + <td>Requests/Second</td> |
| 125 | + <td>P99 Latency (ms)</td> |
| 126 | + </tr> |
| 127 | + <tr> |
| 128 | + <td>10</td> |
| 129 | + <td>6057.91</td> |
| 130 | + <td>3</td> |
| 131 | + </tr> |
| 132 | + <tr> |
| 133 | + <td>50</td> |
| 134 | + <td>5781.69</td> |
| 135 | + <td>11</td> |
| 136 | + </tr> |
| 137 | + <tr> |
| 138 | + <td>100</td> |
| 139 | + <td>5533.35</td> |
| 140 | + <td>24</td> |
| 141 | + </tr> |
| 142 | + <tr> |
| 143 | + <td>500</td> |
| 144 | + <td>5300.36</td> |
| 145 | + <td>114</td> |
| 146 | + </tr> |
| 147 | + <tr> |
| 148 | + <td>1000</td> |
| 149 | + <td>5261.26</td> |
| 150 | + <td>3512</td> |
| 151 | + </tr> |
| 152 | +</table> |
0 commit comments