Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change http request timeout for locust HttpLocust

Tags:

locust

Seems the default timeout is 60 second in FastHttpLocust and HttpLocust. Is there a way to change it? Here is my locust file:

from locust import TaskSet, task, between
from locust.contrib.fasthttp import FastHttpLocust

class HTTPGet(TaskSet):
    @task(1)
    def index(self):
        self.client.get("/")

class WebsiteUser(FastHttpLocust):
    task_set = HTTPGet
    host="http://www.google.com"
    wait_time = between(0.5, 0.5)
like image 917
Yuan Liu Avatar asked Nov 15 '25 05:11

Yuan Liu


1 Answers

In Locust 1.0 and later, you can use network_timeout and connection_timeout on FastHttpLocust.

See https://docs.locust.io/en/stable/increase-performance.html.

class WebsiteUser(FastHttpLocust):
    network_timeout = 5.0
    connection_timeout = 5.0
like image 195
Cyberwiz Avatar answered Nov 17 '25 22:11

Cyberwiz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!