That double_wave.py is just an example of LoadTestShape
, showing that you can do whatever you need to do in order to tell Locust how many users to create and when during your test. You can have an algorithm like that to mathematically create your shape, but you can also do other things like read from a file or database for what values tick
should return. The point is not to "scientifically certify" that this is what a load test of any web app should look like, let alone an e-commerce one in particular.
What you'll want to do is look at whatever metrics or data you are tracking server side for your app and find a way to mimic those. If your real production load happens to look similar to the double_wave.py
example, great. If it doesn't, look for other trends. Do you get more drastic or more sudden spikes in traffic? Do you have a more general slow curve with sustained numbers of requests over time? Is there a specific time or event (sale or marketing push) that you want to be able to reproduce? Whatever it is, you can then decide how to create your Shape, whether a mathematically generated curve is good enough or if you want to get more precise with a long list of points pulled directly from your metrics.
One pro tip I can share, though, is make sure you give your system some headroom. If the most your system has ever needed to handle is 500 RPS, bump everything up and make sure you load test it against 550 or 600 RPS. That will give you room for your traffic to grow and give you extra solid confidence that the 500 RPS max isn't a problem. Optionally, you can push things further and see exactly at what point the system tips over so you know what the absolute maximum limit is.