I am planning to setup nginx as reverse proxy. I will have apache to deliver my dynamic content, and nginx will deliver the static content.
My configuration i have now is just Apache with fastCGI. This gives me no configuration problems and runs great.
After I have set up nginx I want to run some benchmarks to see if I really got some performance increases, else i will switch back.
Does anyone know how I can benchmark this type of setup? Or maybe someone did this already and have some canned results, I will be glad to hear them.
PS. I know this is more a serverfault type of question, but i have seen numerous posts about apache and nginx so i thought i give it a try
At serving static content, Nginx is the king! As Nginx's design architecture is better equipped to handle the load, it is much faster when it comes to serving the static content. It performs 2.5 times faster than Apache according to a benchmark test running up to 1,000 simultaneous connections.
Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.
Apache and Nginx can definitely run simultaneously. The default config will not allow them to start at the same time because they will both try to listen on the same port and the same IP. However, you can easily either change the ports or ports and IPs, or IPs.
Better solution? Siege.
More accurate benchmarking tool than ab
A few things:
Don't use ab. It's single-threaded and you will probably end up benchmarking ab rather than your HTTP server.
Don't run whatever stress tool you use on the same system as the server. The HTTP server will be competing with the tool for CPU and other resources. Plus localhost's idealized version of a network doesn't tell the whole picture (see point 4).
Pay attention to memory and CPU utilization during the tests. So many people never consider this factor. Even if both setups perform equally, if one uses a fraction of the RAM/CPU, then you have a winner.
RPS isn't the only meaningful metric. Things like slow clients (3G smartphones, congested networks, slow PC's) can have a distinctly negative impact on threaded servers. The idealized lab setup (localhost or isolated switch) won't reflect this.
Your FCGI script will be the bottleneck for either server. I'd suggest using a tool that can pull multiple resources (ideally an entire page, including static content) so you can get a complete picture of page load times.
You might consider using one of the "cloud-based" testing tools, such as browsermob.com or loadimpact.com.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With