Running Locust on Azure

yorek

Davide Mauri

Posted on February 17, 2020

Running Locust on Azure

If you are a developer that works in a field where you are asked to create or maintain REST API as your daily job, you'll surely have found yourself in the need of testing API performance at some point. I've found a very nice and simple tool to do that: Locust.

Locust Running On Azure

Locust has several nice features that I really like:

  1. Support distributed deployment. You can create a lot of clients, all managed by a single master, to general a lot of test calls. 
  2. Python-based. The code to test target API is plain Python, all in one file ("locustfile.py"), with some specific objects made available by Locust to make life easier. I really like that.
  3. A single locust file can host more than one test, and each test can have its own weight so that you can exactly decide how to distribute workload
  4. Has a nice user interface that clearly shows Request Per Seconds over time and, in case, Exceptions and Failures
  5. Works very well with Docker and can be dockerized in less than 150 Megabytes

In order to use Locust in Azure in the simplest and easiest way possble, I've create a docker image on Docker Hub:

https://hub.docker.com/repository/docker/yorek/locustio

As I really wanted some really easy and simple to use, I decided to go for Azure Container Instances, and the repo with the script code to deploy Locust is available here:

https://github.com/yorek/locust-on-azure

If you are more inclined to use a more complex but more complete container orchestrator, of course Kubernetes could be better option. 
In the mentioned repo, the script will take care of everything needed to run Locust on Azure:

  1. create a storage account to host to locust file
  2. create a storage share for the locust file
  3. upload the locust file
  4. deploy the master locust and the desired clients in Azure Container Instances
  5. configure master and clients correctly
  6. run the locust swarm

Easy and nice, I can now run test for stability and performance my API.

💖 💪 🙅 🚩
yorek
Davide Mauri

Posted on February 17, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Running Locust on Azure
python Running Locust on Azure

February 17, 2020