Jacobs "Blog"

Load Testing Sites

I needed a quick and dirty way to load test sites. Thankfully for CheckYourSix on Freenode, I'm now able to do that.

CYS pointed me towards locust.io

To install:

python3 -m pip install locust

Setups simple.

$ cat locustfile.py
from locust import HttpLocust, TaskSet, between

def index(l):
    l.client.get("/")                            

class UserBehavior(TaskSet):
    tasks = {index: 2}
    def on_start(self):
        print("Started")
    def on_stop(self):
        print("Stopped")

class WebsiteUser(HttpLocust):
    task_set = UserBehavior
    wait_time = between(5.0, 9.0)

The from that directory, you just run locust and it will spawn up a web server on port 8089.

Go to https://:8089/ and plug your websites details in there. You can configure locust for posting data but I didnt need to.

Once you configure your testing goals and hit submit, you'll be given all the data you need to know. I recommend keeping top open in a terminal to know when to bail out.