Skip to content

koudaiii/distributed-load-testing-using-locust-on-aks

Repository files navigation

Distributed Load Testing Using locust on AKS

Distributed-load-testing-using-locust-on-aks is making an easy to scalable distributed load testing using AKS and locust.

Table of Contents

Created by gh-md-toc

Getting Started

1. Require

  • az command
  • kubectl command

2. Run Bootstrap script

The bootstrap script launches your AKS cluster.

$ script/bootstrap

# Usage: script/bootstrap \
#    [-g MYRESOURCE_GROUP_NAME(Default: DistributedLoadTesting)] \
#    [-a AKS_CLUSTER_NAME(Default: LocustOnAKS)] \
#    [-l LOCATION_NAME(Default: eastus)] \
#    [-c NODE_COUNT(Default: 5)] \
#    [-s NODE_VM_SIZE(Default: Standard_DS3_v2)]

3. How to use WebUI

$ kubectl port-forward svc/locust-master 8089:8089 -n locust
$ open http://localhost:8089
# Change your target url

Example: using myapp

$ script/apply-for-myapp

This locust is already set target URL: http://myapp.myapp.svc.cluster.local

Clean-up

$ script/clean

# Usage: script/clean \
#    [-g MYRESOURCE_GROUP_NAME(Default: DistributedLoadTesting)]

How to use in local

Require

  • Docker
  • kubectl
  • minikube
    • enable metrics-server

Use minikube

  1. deploy to locust and application on minikube
$ kubectl config use-context minikube
$ script/apply
$ script/apply-for-myapp
  1. port forward to locust-master
$ kubectl port-forward svc/locust-master 8089:8089 -n locust
  1. open locust
$ open http://localhost:8089

Use docker-compose

$ cd myapp
$ make
$ cd ../
$ docker-compose up --build

Development

Require

  • locust

How to customize

  • Copy this repository
  • Edit some task files(locustfile.py and lib/)
  • Run locust command, And open http://localhost:8089 .
  • Edit docker image name at Makefile and kubernetes/ manifest files
  • create docker image and push docker image
make push

Contribution

  1. Fork (https://github.com/koudaiii/distributed-load-testing-using-locust-on-aks/fork)
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Create a new Pull Request

Author

koudaiii

License

MIT License