Code Monkey home page Code Monkey logo

locust-template's Introduction

locust-template

Locust performance test template for running locust tests for a REST service*

Requirements and Installation

To run the Locust scripts you need Python 3.6 or later (developed and tested with 2.7.15) with pip, and the dependences specified in requirements.txt (specific versions of: locustio, gevent and Jinja2) which can be installed by running

sudo apt install python3-pip
pip3 install -r requirements.txt

Configuration

Test URL

The default TEST URL http://localhost:8085 is hardcoded in the scripts for quick testing. You should always use the locust -H command line argument to override this default value and specify the base URL you want to attack with your locust swarm.

Timing

Locust tries to simulate real users, a great number of concurrent users with random behaviors including random timing. By default the simulated users wait between 0 and 500 milliseconds between requests (uniform random variable). These parameters can be changed by editing the min_wait and max_wait values at the end of each script. For maximum throughput, set both parameters to 0.

Execution

One server

After configuring the scripts, just run them with locust. For example to run the test PT1 against the URL http://my-url:8080/ run:

locust -f locustfile-PT1.py -H http://my-url:8080/

After running this command, go to the URL printed by locust, by default http://localhost:8089/ and follow the on-screen instructions. You will be able to specify the number of clients to simulate and the ramp-up rate, and then lauch the tests and see the statistics in real time (as well as stop the tests when needed).

Distributed execution

To run a cluster of Locust clients just add the argument --master to one of them, which will be the master, and --slave --master-host=<master's IP> to each of the slaves. The master will show the whole cluster's activity and statistics through its web interface.

locust-template's People

Contributors

pjover avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.