Skip to content
Why should I use a Reverse Proxy if Node.js is Production-Ready?
JavaScript HTML Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
public
.gitignore
README.md
gen-ssl.sh
nginx-cluster-node.conf
nginx-gzip-node.conf
nginx-node.conf
nginx-node.js
nginx-ssl-node.conf
nginx-ssl.conf
nginx.conf
node-cluster.js
node-gzip.js
node-ssl.js
node.js

README.md

nodejs-reverse-proxy-benchmarks

This is a companion repository for our blog post, "Why should I use a Reverse Proxy if Node.js is Production-Ready?"

You will probably want to download a recent stable version of Nginx to perform these benchmarks. You'll also want a recent stable version of Node.js as well.

If you compile Nginx from source make sure you provide the --with-http_ssl_module flag, otherwise the SSL tests will fail.

These tests currently use a single Nginx worker thread via the worker_processes 1; directive. Running them again with 2 workers would yield faster Nginx performance at a trade-off of more memory usage.

The HTTP benchmarks used for the article are done with the siege tool, though any HTTP benchmarking tool should work fine.

Our Results

req/sec approx memory
nginx 25,445 46.1MB
nginx-ssl 959 46.4MB
node 9,881 601MB
node-ssl 746 614MB
nginx-node 8,117 652MB
nginx-ssl-node 865 652MB
node-cluster 8,006 1,768MB
nginx-cluster-node 7,908 1,253MB
node-gzip 5,047 598MB
nginx-gzip-node 7,590 652MB

Running the Benchmarks

The following sections contain instruction for recreating each of the benchmark results:

nginx

nginx -c nginx.conf -p .
siege -c 10 -r 20000 -b http://localhost:8080/

nginx-ssl

./gen-ssl.sh # only needs to be run once
nginx -c nginx-ssl.conf -p .
siege -c 10 -r 20000 -b https://localhost:8443/

node

./node.js 8080
siege -c 10 -r 20000 -b http://localhost:8080/

node-ssl

./gen-ssl.sh # only needs to be run once
./node-ssl.js
siege -c 10 -r 20000 -b https://localhost:8443/

nginx-node

./node.js 8081
nginx -c nginx-node.conf -p .
siege -c 10 -r 20000 -b http://localhost:8080/

nginx-ssl-node

./gen-ssl.sh # only needs to be run once
./node.js 8081
nginx -c nginx-ssl-node.conf -p .
siege -c 10 -r 20000 -b https://localhost:8443/

node-cluster

./node-cluster.js
siege -c 10 -r 20000 -b http://localhost:8080/

nginx-cluster-node

./node.js 8081
./node.js 8082
nginx -c nginx-cluster-node.conf -p .
siege -c 10 -r 20000 -b http://localhost:8080/

node-gzip

./node-gzip.js
siege -c 10 -r 20000 -b http://localhost:8080/

nginx-gzip-node

./node.js 8081
nginx -c nginx-gzip-node.conf -p .
siege -c 10 -r 20000 -b http://localhost:8080/
You can’t perform that action at this time.