--- title: Server speed benchmarks date: "2011-03-12T08:23:44Z" categories: - coding wp_id: 2618 description: I benchmarked Node.js against PHP, Tornado, and Nginx using a simple Hello World test. I found Node.js surprisingly faster than Nginx serving a static file, achieving 2,500 requests per second using the Apache Benchmark tool. keywords: [node.js, nginx, apache benchmark, tornado, web server performance, php] ---
Yesterday, I wrote about node.js being fast. Here are some numbers. I ran Apache Benchmark on the simplest Hello World program possible, testing 10,000 requests with 100 concurrent connections (ab -n 10000 -c 100). These are on my Dell E5400, with lots of application running, so take them with a pinch of salt.
PHP5 on Apache 2.2.6<?php echo “Hello world” ?> | 1,550/sec | Base case. But this isn’t too bad |
| Tornado/Python See Tornadoweb example | 1,900/sec | Over 20% faster |
Static HTML on Apache 2.2.6Hello world | 2,250/sec | Another 20% faster |
Static HTML on nginx 0.9.0Hello world | 2,400/sec | 6% faster |
| node.js 0.4.1 See nodejs.org example | 2,500/sec | Faster than a static file on nginx! |
I was definitely NOT expecting this result… but it looks like serving a static file with node.js could be faster than nginx. This might explain why Markup.io is exposing node.js directly, without an nginx or varnish proxy.
--- ## Comments - **Olivier** _12 Dec 2011 3:39 am_: Nginx has to read the file from the disk each time. Nodejs has the content of the file in memory. So it's normal that nodejs is faster than Nginx. Re-test the same thing but setup Nginx so it caches files in RAM and you'll see the truth. - **Seamsky** _4 Jun 2013 11:31 pm_: Please, use "return 200 'Hello world';" for nginx instead of serving file from hard drive.