-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Be able to define bursty traffic #225
Comments
Two locusts? One for baseline and another for the burst? Your "burst" locust could sleep for K seconds and repeat. That's what I would do. |
What @4tapsmobile is suggesting might work for you. It should also be fairly easy to achieve by overriding the Line 327 in ab6f330
Here's a start: from time import time
from locust import TaskSet
class BurstingTaskSet(TaskSet):
K = 10
J = 3
burst_wait_time = 0.1
bursting = False
interval_start = time()
def set_bursting(self):
if not self.bursting and time() - self.interval_start > self.K:
self.bursting = True
self.interval_start = time()
elif self.bursting and time() - self.interval_start > self.J:
self.bursting = False
self.interval_start = time()
def wait(self):
self.set_bursting()
if self.bursting:
self._sleep(self.burst_wait_time)
else:
super(BurstingTaskSet, self).wait() If you want to synchronise the bursting between a lot of running locust users (which take time to spawn, and might run distributed on different servers), you probably want to add some synchronisation logic that uses the system clock. |
Perhaps there is a way to do it with existing functionality but I would like a way to generate bursty traffic.
By that I would mean : define it in terms of standard deviations or multiples of baseline load for a certain interval.
So for now, if I have a N single workers I will have on average M = N * (min_wait + max_wait) /2 requests per second made.
What I would like is - every K seconds increase the load to say M * L requests per second for J seconds, where J,K,L > 1
Thoughts?
The text was updated successfully, but these errors were encountered: