Benchmark a Website with Locust IO

Posted on March 23, 2017 in benchmark, locust, website

Source: Locust IO


It's quite simple to install locustio :

pip install locustio



Next, we create a simple scenario which will realize the following operations (with differents methods) :

  • Call
  • Call
  • Call
from locust import HttpLocust, TaskSet, task
import resource

def get_index(l):

def get_pdf(l):

class UserTasks(TaskSet):

    resource.setrlimit(resource.RLIMIT_NOFILE, (999999, 999999))

    # Using an array
    tasks = [get_index, get_pdf]

    # Using the task decorator
    def get_article(self):

class WebsiteUser(HttpLocust):
    Locust user class that does requests to the locust web server running on localhost
    host = ""
    min_wait = 2000
    max_wait = 5000
    task_set = UserTasks

Please note that the following code is needed to bypass the limit of 1000 users :

resource.setrlimit(resource.RLIMIT_NOFILE, (999999, 999999))


You need to be allowed to launch a benchmark !

First, you launch Locust-IO :

locust -f /my/folder/to/my/ --host

Please note that your script can't be called !

Finally, we open a browser to http://ip-local:8089 , and fill :

  • Number of users to simulate
  • Hatch Rate

Schema Locust IO

And click on Start swarming !

Schema Locust IO