Web server load testing is a very well-known process in performance testing. By testing your web server, you can pinpoint performance bottlenecks and improve your server performance. But what is the best way to load test a server?
In this article, you will learn about:
- General overview of web server load testing
- How to effectively perform load testing
- Load limits
Load testing is simply a part of performance testing. It goes alongside stress, spike, endurance, scalability and volume testing. However, this article will focus solely on web server load testing. Just like any other load testing, this process tests the load limit of a particular web server.
We all know that a web server is software and hardware that uses HTTP and other protocols to respond to requests made over the internet. The hardware side is the computer device that stores the web server software and a website’s component files. On the software side, a web server processes web user requests and when configured to do so can receive and store resources from a user agent. Without web servers, a website can’t access or display content at all, which is why performance and web server load testing are necessary.
Load testing determines the maximum amount of work a server can handle without degradation. You can run load tests under controlled lab conditions to accurately evaluate behavior in different systems or in the field to see how the server functions under real-world conditions.
Don’t mistake load testing for stress testing. Load testing runs under normal conditions, while stress testing evaluates the server’s behavior under peak loads or beyond normal conditions.
Examples of Load Testing
There are numerous examples of load testing. Here are just a few:
- Simultaneously downloading large files from the internet
- Running multiple applications simultaneously on a server
- Subjecting the server to a large amount of email traffic
- Simultaneously writing and reading data to and from a hard disk
How to do Load Testing
How to load test a web server? There is no one course of action when performing web server load testing, because everything depends on what server you are using. Nonetheless, here are some ways to perform load testing.
Manual Load Testing
Primarily done by users, manual load testing does not yield repeatable results. The process is complicated to coordinate, so this particular way of testing rarely delivers a conclusive measurable level of load testing.
In-house testing requires a more customized load tester where organizations build tools tailor-fit for their servers. It is more costly and time-consuming, but worth the investment for organizations that recognize the importance of high-performing web servers.
Open-source load testing tools
Not everyone can afford to build their testing tool, and manual testing is high-risk for showing problems. The other option is open-source load testing tools. Free of charge and with significantly different features from their paid counterparts, open-source tools do basic tests quickly and correctly.
Web Server Load Testing with ApacheBench
In February 2021, Netcraft published a web server survey that contains the latest statistics on the top web server on the market:
- Cloudflare Server
Since web server software is plentiful, let’s focus on the benchmarking tool for Apache, the second most popular server.
ab (ApacheBench) is a handy tool for load testing Apache web servers that comes with your Apache installation and produces valuable reports, such as the number of requests per second that the server can handle.
Load test web server with ab:
- Install the Apache web server package along with the dependencies for your OS
$ sudo apt update && sudo apt install --assume-yes apache2 # Ubuntu and Debian derivatives
$ sudo yum install --assumeyes httpd # CentOS and RedHat derivatives
- Take note of the URL of the page you want to perform a load test
- Run ab on the selected web page
$ ab -n <number_of_request> -c <concurrency> <url>
Suppose you want to know how http://www.example.com/ can handle 100 requests, with a maximum of 10 concurrent requests:
$ ab -n 100 -c 10 http://www.example.com/
- After running ab, the results will appear. Analyze the most important results, such as Requests per second and Time per request
- Once you’ve come up with conclusions, tweak your web server settings
- Redo the test attentively until you achieve satisfactory results
One of the main goals of web server load testing is to measure response time. However, a web server can become unresponsive if it nears its limit. Therefore, it is essential to know what the load limits are, what causes them and their symptoms.
Each web server has its predefined load limits, meaning a server can only handle a limited number of client connections. Also, web servers can only serve a maximum number of requests per second. These conditions depend on the following factors:
- Server settings
- Average HTTP request type
- A static or dynamic content request
- Cached or compressed content
- Number of active Transmission Control Protocol (TCP) connections
- Limitations of the hardware or software on which the web server runs
Causes of Overload
There are numerous reasons why a web server overloads. To narrow them down, we listed the most common reasons that IT teams encounter such overloads:
- Thousands or millions of clients are connecting to the website in such a short time interval
- Computer worms and Infected browsers and/or web servers. These sometimes cause abnormal traffic due to millions of infected computers, browsers or web servers
- Internet bots that are not filtered on large websites
- Internet or network slowdowns where the client requests are served more slowly. When this happens, the number of connections increases significantly until the server reaches its limit
- Web servers partial unavailability due to maintenance or system failure
Symptoms of Overload
How can you determine server overload even before you conduct web server load testing? Here are some symptoms of server overload that you should always look out for:
- Delay in request response
- HTTP error code
- Web server resets or refuses TCP connections before returning any content
- Returns only parts of the content (behavior considered a bug)
There is a famous saying that one should “cross the bridge when you get there.” However, you can still plan for how you cross that bridge before it appears right in front of you! One way is to equip yourself with techniques to prevent overloading your server.
- Manage your network traffic by filtering traffic that comes into the server and blocking any unwanted traffic like bots with a firewall
- HTTP traffic managers redirect or rewrite requests containing bad HTTP patterns
- Bandwidth management
- Web cache techniques
- Practice using different domains to serve different content by separate servers
- More hardware resources
- Use more web servers
Web Server Load Testing with Stackify
Web server load testing is an essential process in performance testing. Since load testing is a part of a more extensive application performance test, you need to choose a tool that focuses on more than just load testing. You need a tool that can do stress, spike, endurance, scalability and volume testing. What you need is a reliable application performance monitoring (APM) system.
Retrace is the best APM tool you will ever experience and much, much more. Retrace not only offers web server monitoring but also provides a comprehensive view of your application’s performance, too. You can monitor everything about your servers, uncover actionable insights and receive automated alerts and notifications.If you’d like to experience what Retrace can bring to your testing table, sign up now for your FREE 14-day Retrace trial.
- The Top 5 Node.js Performance Measurement Metrics - August 31, 2021
- How to Handle Global Exception Handler with C# Web API - August 18, 2021
- How to Troubleshoot Performance with a Visual Studio Profiler - August 2, 2021
- Top Visual Studio Profiling Tools - July 16, 2021
- Best Way to Load Test a Web Server - July 2, 2021