DEV Community

Cover image for simple Load testing using Locust
Antoine
Antoine

Posted on

simple Load testing using Locust

Photo by James Wainscoat on Unsplash

Locust is a system using python to define load testing.
It relies on a main node (hosting UI) to report data. Workers nodes executes workloads.

Loads are defined through objects: Users, tasks

A quick way to test, is to use the following docker-compose:

version: '3'

services:
  master:
    image: locustio/locust
    ports:
     - "8089:8089"
    volumes:
      - ./:/mnt/locust
    command: -f /mnt/locust/locustfile.py --master -H http://master:8089

  worker:
    image: locustio/locust
    volumes:
      - ./:/mnt/locust
    command: -f /mnt/locust/locustfile.py --worker --master-host master
Enter fullscreen mode Exit fullscreen mode

The web UI is then accessible on port 8089 .

UI

Configuration

Locust as written in its docs that Locust uses:

  • User : to define profile
  • Task : to define workload, associated to a weight
  • Events : to define extension points

This repository has a simple example on how to defaine configuration.

Hope this helps !

Top comments (0)