Do you need to run load tests? Vegeta to the rescue!

Carlos Augusto Souza Lima
2 min readAug 22, 2017

--

It’s heavy????

Imagine that your team is confronted with the following questions:

  • How well is the application performing?
  • What would be the system bottleneck?
  • Are there any improvements that we need to do in our architecture or infrastructure?

Systems can fail at any moment, so what could one do to discover and explore the cause? What can make the system fault-tolerant? What strategy should be used?

Our team (New Offers) at Chaordic was confronted with these questions when calculating the freight quotes on our system. So, we decided to use the Load Tests to help us find the answers.

But, what are Load Tests?

They are tests which the main goal is to find the application capacity limit, identifying the limiting factor (software, hardware, response time).

How can Vegeta help us?

Vegeta is a versatile HTTP load testing tool built out of a need to drill HTTP services with a constant request rate.

Yeah!!! Vegeta has superpowers! The step-by-step would be:

  • Create a targets file with the endpoints you want.
  • Create a request JSON. (optional)
  • Yeah! Let’s go!!! Vegeta attack!!!

What endpoint do we desire to test?

A list of endpoints and its respective methods should be put in the targets file, such as:

Creating request files

When a POST/PUT endpoint will be tested, a request file should be created. For example:

What happens when Vegeta attacks?

When Vegeta attacks it generates a report, which can, later on, be used for exploratory analysis. To start Vegeta, run:

At the end of the attack, we can generate a report with the following command:

The report can be generated in other formats, for example:

This image is a plot that shows a request, the X axis represents the time at the start of the request and the Y axis represents the time taken to complete that request.

Load Tests Strategy

Our team decided to create three scenarios to apply the load tests:

  • Easy: simplest scenario.
  • Medium: a bit more complex scenario and closer to the real one.
  • Hard: it’s not the scenario we face in our day-to-day life but it’s possible.

For each scenario, we run load tests during five minutes making 2, 5, 10, 15 and 20 requests per second totaling 15600 requests and 25 minutes of tests.

Conclusions

  • The load tests are very important to help us have the correct inputs on how much our system is performative.
  • Vegeta helped us to find our possible architecture bottlenecks.

References

--

--