Website Load Testing
Here at Crucial we have a large number of customers running their own VPS & Dedicated Server hosting environments. However, as some customers who deal with very high traffic websites know all too well, a single server is not always enough to meet certain demands.
Depending on the website, or campaign or application, sometimes it is necessary to separate the various layers involved eg. http & database, and run them on their own individual servers either virtual or dedicated. This is why we also have a wealth of expertise & experience configuring multiple server and Load Balancing environments for our customers.
The difference between a good web or system admin basically comes down to one thing, preparation. Building an environment but not knowing how to optimize it effectively can be costly. Additionally, not planning adequately for future scalability can bring your business to a crawl, right when you need it most.
For both situations the old cliche applies, knowledge is power! In order to both plan ahead and optimize effectively, you need to monitor and record as much data as you can before you are production ready.
In this blog I’m going to detail some of the issues of planning and optimization and more importantly some of the load testing & benchmarking tools available.
In terms of load testing and optimizing your environment there are endless avenues however, the considerations will basically come down to the following questions:
- What resources are available? CPU / RAM / Disk IO & Disk Space / PortSpeed / single or multiple server / load balancers etc.
- Which processes/services are required? Apache, Lighthttpd, NginX, MySQL, PHP, Varnish, TomCat, Ruby, and how many resources do they consume etc.
- How many users are visiting? Are they regular? Are they temporary eg. sales/campaigns? are they increasing over time? etc.
To make sure your environment is covered, you need to know how these 3 factors interact during their minimum and maximum usage. In order to get an idea of performance, the best approach is to simulate as many users as possible hitting the environment and generating as much load as possible.
Load Testing:
There are several methods of load testing, depending on your development environment eg. if it is private or public etc. However, the general principal is simple — use an external server or servers, that will hit your dev server multiple times in order to simulate specific usage loads.
Keep in mind with “paid” services which turn some people off, unless you are testing privately eg. offline, ideally you will need a server with public access to your dev environment from which to run your load testing from eg. a temporary VPS service. This will cost you money either way, but the whole point of preparation is to get things right. Some upfront expenditure for testing might save you a fortune down the line.
Here are some example tools at your disposal.
- Apache Bench:
One of the simplest ways to test a web server running Apache is by using “ApacheBench” or as it is affectionately abbreviated “ab”. Spin up a Linux, Mac or Windows environment with Apache and you should have access to “ab”. A simple command such as:
ab -n 200 -c 50 http://mydevsite.com > loadtest01.txt
The above command will run ApacheBench spawning 200 requests to the example URL and running them 50 at a time, outputting the results to a text file.
While considered fairly basic, ApacheBench has a number of flags which you can use to fine tune your testing. You can even get more technical and output the results to graphs and the like.
- LoadStorm :
LoadStorm is a cloud-based load testing tool for web apps. The service is free for 25 concurrent users, but requires payment for testing above that amount which is very reasonable, all the way up to 100,000 concurrent users!
Whilst it doesn’t provide the full range of enterprise tools of some other options, it does what most users need from traffic simulation from form submission and link following. Features real time graphs with a range of metrics.
- WeigHTTP:
WeigHTTP or “Weighty”, is a lightweight webserver benchmarking tool. It is lean and it is fast and supports multithreading to make use of multi-core CPU’s. Like AB, Weighty is simple to get going and to run tests via the command line. Simply spin up a Linux test environment, download the installer and get started!
- LoadImpact:
LoadImpact is a paid load testing service (they also offer a free entry-level testing option), which will provide real time traffic simulation generated on demand and globally via their numerous servers around the world. Unfortunately, at this stage there is no local Australian load testing node but the results are still very useful.
LoadImpact is extremely intuitive to use, allowing you to select a range of variables for your load simulation and detailed real time results. They also collect extensive reporting, which is output & graphed in a way in which you don’t need a PHD to decipher. They can even provide Optimization advice for you!
- Blitz.io:
Blitz.io is another paid load testing service with very similar features to the previous example. However, they offer some other services such as 24×7 monitoring and useful tools such as API integration, which will allow you to integrate Blitz into your current environment and play nicely with your traffic monitoring tools such as Google Analytics.
When you’re making changes & optimizing your live environment, Blitz can monitor performance and analyse monitoring data in order to create load tests to verify your changes.
- jMeter:
Last but by no means least is Apache jMeter, which is a Desktop Java application specifically designed to test load and performance for a range of services, specifically web applications. jMeter offers a full multithreading framework and basically no limit to it’s capabilities for testing any load you need to generate and for any environment.
Due to the depth of jMeter there is a bit of a learning curve. It can also cause you a few issues if you rush into it without understanding what you are doing. Extensive reading of the jMeter website user manual & best practices is highly recommended if you don’t want to accidentally DDoS yourself or worse. It is definitely recommended that you start off in a controlled environment where you cannot have too much network impact eg. an isolated private network, until you are familiarized with the software.
Combine jMeter with some resource graphing tools like Cacti and you will become lord of the benchmark!
At Crucial HQ we perform extensive load benchmarking on customer environments, from customers running Load Balancing clusters to our own internal infrastructure, using the above tools and more. Additionally, we’ve found the following track with Arnold’s motivational words works perfectly as a load testing soundtrack: Luke Millions – Arnold (Your Bench instructor).
Hosting Options & Info | VPS | Web Solutions & Services |
---|---|---|