If you are working on a serious project, you want it to scale. The thing about scale is, you only focus on it once you really need it.
I’m the CTO of an soccer/futbol social network based in Brazil. To put it mildly, futbol is big in my country. This summer, we focused our marketing on the World Cup, preparing our application to support as many users as possible. To do that, we had to benchmark and improve, but how could we load test? What tool should we use? Those are just some questions that came up once we started to address this challenge.
This is when we found Loader.io.
Where Did It Come From?
Loader.io is a stress testing service. It’s not just a tool, as it helps you to focus on what to test. It’s developed by SendGrid, and they describe the service like so:
Loader.io is a free load testing service that allows you to stress test your web-apps/apis with thousands of concurrent connections.
How to Setup
Loader.io tries to simulate users and their impact on your application, rather than focus on code. This gives a more realistic result, but it is not a guide that shows where you focus to increase performance. Loader.io will uncover scaling issues, but it’s up to you to find the fix. In our case, the results were compelling and we were able to hunt down our scaling issues.
First things first, you need an account on Loader.io (no worries, they won’t fill your inbox). When signing up, you need to select a plan, and the free one will work for your initial needs.
Once the account is created, Loader.io will ask you to confirm your domain. They can even help you, if you need it.
Heroku users are covered, Loader.io is a plugin, which makes it very simple to utilize the service.
Your First Test
Once you have added Loader.io to your application, use the web interface to add your first test:
There are a few, simple options to setup your test. The interface will guide you to scenario that best emulates your needs:
- Clients per test (Clients will be distributed evenly throughout the test duration.)
- Clients per second (Clients will be started each second)
- Maintain client load (A constant client count will be maintained throughout the test duration.)
The scenario you choose depends on the usual user behavior for your application. In most cases, you’ll want to create more than one test to cover multiple scenarios.
With the first test ready to go, Loader.io will run it and display the results. The whole process is simple and the results are easy to understand. I will run through some test results in a bit.
Stress Test as Culture
Today, we are used to writing tests/spec to our applications. It’s a part of Ruby culture. Stress testing, on the other hand, isn’t a common priority. More often than not, developers and companies only think about it after disaster occurs.
I see Loader.io as a facilitator in making stress tests a more common practice for application development. Besides everything I have shown so far, one of the best features of Loader.io is it’s API. It makes it possible to integrate your tests into your deployment routine. It’s a major win, helping you to keep your code’s quality and performance high and scalability-minded.
Real Case Example
Here are my first test results after deciding it was time to stress test our application for the World Cup (Needless to say, after this I got really worried):
Loader.io’s results pointed out that, when 15 requests hit in the same minute (1 for each 4”), only 3 received responses. The average time of each response was 9456ms (exactly, 9.5 seconds). Yikes!
I started by updating tiny details, trying to pinpoint the scaling issues. I then moved forward to refactoring code, adding indexes, and updating database structures. After this, I added caching and compost caching on everything possible.
I didn’t slept for 3 nights, but the results were amazing. This is the result of the test 3 days after the first one:
Instead of just 15 requests in one minute, this time it was 300 requests (5 for each second). The app now had 299 successful responses, with an average response time of 627ms. Yeah, it was awesome.
Wrap Up
If you are serious about your application, you need to work on scalability as soon as possible. Making stress tests a part of your development culture is the best way to guarantee that you will be ready to scale your application when needed.
There are many tools that help you to stress test your apps, but Loader.io is definitely one of the best I have used so far. Give it a try.
Frequently Asked Questions (FAQs) about Stress Testing with Loader.io
What is stress testing and why is it important?
Stress testing is a type of performance testing that aims to evaluate the stability and reliability of a system under extreme conditions. It is designed to test the upper limits of the system by subjecting it to a load that exceeds its normal working capacity. This is important because it helps identify potential bottlenecks, weak points, and failures in the system that could impact its performance or cause it to crash under heavy load. By identifying these issues in advance, developers can make necessary adjustments to ensure the system can handle high traffic volumes and perform optimally under stress.
How does Loader.io help in stress testing?
Loader.io is a cloud-based load testing service that allows developers to stress test their web applications and APIs with thousands of concurrent connections. It provides a simple and intuitive interface for creating and running tests, and it offers real-time results and analytics to help you understand how your system performs under different load conditions. With Loader.io, you can simulate various scenarios, such as a sudden spike in traffic or a gradual increase in load, to see how your system responds and identify any potential issues.
What are the key features of Loader.io?
Loader.io offers a range of features designed to make stress testing as easy and effective as possible. These include the ability to test with up to 10,000 clients per test from multiple geographical locations, support for GET, POST, PUT, DELETE, PATCH and HEAD HTTP methods, and the ability to set custom headers and payloads. It also provides detailed test results and analytics, including response times, error rates, and server CPU usage, to help you understand and optimize your system’s performance.
How do I set up a test in Loader.io?
Setting up a test in Loader.io is straightforward. First, you need to create a new test by specifying the target URL, the type of load (clients per test or clients per second), and the duration of the test. You can also set additional parameters, such as the HTTP method, headers, and payload, if needed. Once the test is set up, you can run it immediately or schedule it to run at a later time. After the test is completed, you can view the results and analytics in the Loader.io dashboard.
Can I use Loader.io to test non-web applications?
Loader.io is primarily designed for testing web applications and APIs. However, it can also be used to test any system that can be accessed over HTTP or HTTPS, including mobile apps and microservices. Please note that you may need to configure your system or network settings to allow Loader.io to send requests to it.
How does Loader.io compare to other load testing tools?
Loader.io stands out for its simplicity, scalability, and cloud-based architecture. Unlike many traditional load testing tools, it doesn’t require any installation or complex setup, and it can generate a large amount of load from multiple locations around the world. It also provides real-time results and analytics, which can be invaluable for understanding and optimizing your system’s performance. However, like any tool, it may not be suitable for all use cases, and it’s always a good idea to evaluate multiple options before making a decision.
Is Loader.io free to use?
Loader.io offers both free and paid plans. The free plan allows you to run tests with up to 10,000 clients and 1 minute duration, which may be sufficient for small-scale testing. The paid plans offer more clients, longer test durations, and additional features, such as priority support and advanced analytics.
How can I interpret the results from Loader.io?
Loader.io provides a range of metrics to help you understand how your system performs under load. These include the average, median, and 95th percentile response times, the number of successful and failed requests, and the server CPU usage. By analyzing these metrics, you can identify any bottlenecks or issues that may be affecting your system’s performance and take steps to address them.
Can I integrate Loader.io with other tools?
Yes, Loader.io provides a REST API that allows you to integrate it with other tools and automate your testing process. You can use the API to create, run, and manage tests, and retrieve test results and analytics.
What kind of support does Loader.io offer?
Loader.io offers a range of support options, including a comprehensive documentation, a community forum, and email support. The level of support you receive may depend on your plan, with priority support available to paid users.
I’m a leader engineer and manager, currently living in São Paulo, Brazil. I'm an enthusiast technologist that love open source, a blog author in RubySource and my own blog, and also a speaker of some international and national conferences like TakeOff Conf in France, Ruby Italian Day in Italy, GURU, SevenMasters and others.