The World is Mean, So Your Load Tests Must Be Meaner


It's amazing how your backend service works fine when testing it with curl, postman or a frontend GUI, but fails all over the place when unleashing a mean load testing tool like siege on it:

The world is mean, so prepare your app by using a mean testing tool. My favourite is siege. In addition be an excellent and scriptable shell command, it can sustain heavy load creation much better than e.g. JMeter, which I've on several occations seen freeze up when the going gets rough.

Here's a non-trivial example of using siege for testin both read and write performance of a backend system:

$ siege \
    --concurrent=255 \
    --time 10S \
    --header="Authorization: Bearer eyhunter2.." \
    --header="X-Important-Id-For-App: foo-bar-baz" \
    --content-type=application/json \
    --json-output \
    --benchmark \
    --internet \
    --no-parser \
    --file /tmp/load-test.siege

The contents of /tmp/load-test.siege:

# Service discovery document, generated so can be expensive
http://localhost:8000/openapi.json

# Read book
http://localhost:8000/book/1

# Read a thousand books
http://localhost:8000/book/?count=1000

# Create book
http://localhost:8000/book POST {"title": "The Iliad", "author": "Homer"}

# Create library
attic_name="My loft"
http://localhost:8000/library POST {"name": "The Attic called ${attic_name}"}

As you can see in the library example, siege has rudimentary support for variables too. Read the fine manual with man siege and learn further details about this excellent tool.

Happy load testing!


Licensed under CC BY Creative Commons License ~ ✉ torstein.k.johansen @ gmail ~ 🐘 @skybert@hachyderm.io ~ 🎥 youtube.com/@skybert