Load testing is essential for web applications to know website capacity. If you are to choose the webserver, then one of the first things you want to do is perform the load testing and see which one works well for you. Benchmarking can help you to decide;
Which web server works the best Number of servers you need to serve x number of requests Which configuration gives you the best results Which tech stacks perform better When your site will perform slower or breakdown
There are several online tools to perform a stress test; however, if you are looking for an in-house solution or want to benchmark just the webserver performance, then you can use ApacheBench and alternatively some of the below-listed tools. I’ve used Apache & Nginx web server hosted on DigitalOcean to test it.
ApacheBench
ApacheBench (ab) is an open-source command-line program that works with any web server. In this post, I will explain how to install this small program and perform the load test to benchmark the results.
Apache
Let’s get ApacheBench installed by using a yum command. If you already have httpd-tools, then you may ignore this. Now, let’s see how it performs for 5000 requests with a concurrency of 500. So as you can see, Apache has handled 373 requests per second, and it took a total of 13.389 seconds to serve the total requests. Now you know the default configuration can serve these many requests so when you make any configuration changes you can do the test again to compare the results and choose the best one.
Nginx
Let’s make the test what we did for Apache so you can compare which one performs better. WOW! Did you see that? Nginx handled 6593 requests per second! A winner. So you see just comparing with two web servers you will get an idea which one to choose for your web application. The above test is on CentOS 6.8, 64 bit. You can try multiple combinations of OS & Web Server version for the optimal results. Don’t like ApacheBench for whatever reason? No worries, there are plenty of others you can use to perform HTTP load.
SIEGE
SIEGE is an HTTP load test utility supported on UNIX. You can put multiple URL’s in a text file to load tests against. You can install siege using yum. Let’s run the test with 500 concurrent requests for 5 seconds. To break down the parameters. -q – to run it quietly (not showing request details) -t – run for 5 seconds -c – 500 concurrent requests So as you can see, the availability is 100% and the response time is 0.04 seconds. You can tweak the load test parameter based on your goal.
Ali
Ali is a relatively new load testing tool to perform real-time analysis. It supports multiple platforms to install, including Docker. Once installed, execute ali to see the usage details. As you can see above, you have an option to send HTTP headers, test duration, rate limit, timeout, and more. I did a quick test on Geekflare Tools and here is the output looks like.
The report is interactive and gives detailed latency information.
Gobench
Gobench is written in Go language and simple load testing utility to benchmark the web server performance. It supports more than 20,000 concurrent users which ApacheBench doesn’t.
Apache JMeter
JMeter is one of the most popular open-source tools to measure web application performance. JMeter is java based application and not only a web server, but you can use it against PHP, Java. ASP.net, SOAP, REST, etc. JMeter got decent friendly GUI, and the latest version 3.0 require Java 7 or higher to launch the application. You must give a try to JMeter if your goal is to optimize the web application performance.
wrk
wrk is another modern performance measurement tool to put a load on your web server and give you latency, request per second, transfer per second, etc. details. With wrk, you can specify to run a load test with a number of threads. Let’s take an example of running a test for 5 minutes with 500 concurrent users with 8 threads.
Autocannon
Inspired by work, autocannon is written in Node.js. You can use it programmatically, through API or standalone utility. All you need is NodeJS installed as a prerequisite. You can control a number of connections, requests, duration, workers, timeout, connection rate and offer tons of options to benchmark your web applications.
Curl-loader
curl-loader is written in C to simulate application load, and it supports SSL/TLS. Along with the web page test, you can also use this open-source tool to perform load on FTP servers. You can create a test plan with a mix of HTTP, HTTPS, FTP, and FTPS in a single batch configuration.
httperf
The httperf is a high-performance tool that focuses on micro and macro-level benchmarks. It supports HTTP/1.1 and SSL protocols. If you have the expected number of concurrent users and looking to test if your web server can serve a number of a request, you can use the following command. The above command will test with 100 requests per second for 1000 HTTP requests.
Tsung
Tsung is a multi-protocol distributed stress testing tool to stress HTTP, SOAP, PostgreSQL, LDAP, XAMP, MySQL server. It supports HTTP/1.0, HTTP/1.1, and cookies are automatically handled. Generating a report is feasible with Tsung. Conclusion I hope the above benchmarking tools give you an idea about your web server performance and decide what works best for your project. Next, don’t forget to monitor your website performance.