Skip to content

ariogames/load-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Load Test Using Locust

Distributed load test tool used in Ario development.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Latest version of docker, you can read the installation instructions here.

Installing

First you need to build the docker image:

docker build -t arioloadtest:latest .

And then you can run it using the following command

docker run --name myloadtest -p "8089:8089" \ 
--env LOCUST_API_HOST=http://example.com \
--env LOCUST_API_URLS=/api1,/api2,/api3 \
--env LOCUST_API_HEADERS={"Authorization":"test"} \ 
--env LOCUST_USER_MIN_WAIT=500 \
--env LOCUST_USER_MAX_WAIT=200 \
arioloadtest:latest
 

now web ui should be available at http://localhost:8089

Environment variables

The env variables should be used to configure the tool:

  • LOCUST_API_HOST sets the base url of the API.
  • LOCUST_API_URLS endpoints you want to test, separated by ,
  • LOCUST_API_HEADERS requests headers should be set in json format
  • LOCUST_USER_MIN_WAIT minimum wait time between each request for virtual users.
  • LOCUST_USER_MAX_WAIT maximum wait time between each request for virtual users.

Deployment

The tool can be used in distributed mode using the following commands:

On master node:

docker run --rm --name loadtestmaster -p "8089:8089" -p "5557:5557" -p "5558:5558" ariogames/loadtest:latest locust --master

Then go tho the http://<MASTER_IP_ADDR>:<MASTER_WEB_PORT>/config/edit and submit your test configuration json. you can POST the test configuration to master node, at the http://<MASTER_IP_ADDR>:<MASTER_WEB_PORT>/config endpoint, either:

{
  "host": "http://api.example.com",
  "urls": ["/api1", "/api2"],
  "headers": {"Authorization": "test-token"},
  "min_wait": 100,
  "max_wait": 200
}

Now run slave nodes:

docker run --rm --name loadtestslave --env LOCUST_MASTER_IP_ADDR=<MASTER_IP_ADDR> --env LOCUST_MASTER_WEB_PORT_ADDR=8089
ariogames/loadtest:latest

Finally browse to http://<MASTER_IP_ADDR>:<MASTER_WEB_PORT> and start your tests, you can change the test configurations any time you want and restart your tests using the web panel.

Built With

  • Docker - The Container platform
  • pip - Dependency Management
  • Locust - An open source load testing tool

Authors

License

This project is licensed under the MIT License.

Acknowledgments

  • Bardia helped a lot in api based configuration part
  • Many thanks to Locust

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published