One way to restrict the quantity of requests in Locust when carrying out tasks in a sequential category is to use the wait_time
parameter. By setting a specific wait_time
between requests, you can limit the number of requests that are made within a certain time period.
For example, if you want to make 5 requests per minute, you can set the wait_time
to 12 seconds (60 seconds / 5 requests = 12 seconds) between each request:
class MyTaskSet(TaskSet):
@task
def sequential_task(self):
self.client.get("/page-1")
self.wait_time = 12
self.client.get("/page-2")
self.wait_time = 12
self.client.get("/page-3")
# etc.
By setting the wait_time
to 12 seconds between each request, you ensure that each request is separated by at least 12 seconds, limiting the number of requests that can be made in a minute to 5.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-12-09 11:00:00 +0000
Seen: 9 times
Last updated: Dec 23 '22
What is the mean number within each category?
How can the color of e_line in echarts4r be associated with a categorical variable?
In NextAuth.js, why is the HTTP GET action not supported and resulting in an error?
What are the steps to resolve Rate limit errors when utilizing GPT3 Models with Tenacity?
How can we track and observe requests made to Firestore?
What does it mean when proxies are marked as 'dead' in a Scrapy spider?
How to send API requests to a different docker container, using NextJS and NodeJS?
How can custom requests be implemented in Django REST Framework?