I'd like to simulate spikey traffic, so that for example:
T0
)T+5
)T+10
)Is it possible to create an equal number of users, but instead of doing that every second change that to every xx minutes?
There is no such built in feature (https://github.com/locustio/locust/issues/1353 might solve this if it is ever implemented)
One way to do a workaround is to spawn all your users right away (using a spawn rate of something like 100/s), and have them sleep until it is time to run:
import time
start = time.time()
class User1(HttpUser):
@task
def mytask(self):
# do actual task
class User2(HttpUser):
@task
def mytask(self):
while time.time() - start < 300:
time.sleep(1)
# do actual task
class User3(HttpUser):
@task
def mytask(self):
while time.time() - start < 600:
time.sleep(1)
# do actual task
...
You can probably do something clever and put it all in one class, but I'll leave that as an exercise :)