对于 Locust 的负载测试,每个 Locust 用户能否可靠地每 x 秒发送一次请求?
For load testing with Locust, can each locust-user reliably send a request every x seconds?
我将使用 Locust 在网络上执行一些负载测试 api。我正在尝试计算我需要多少蝗虫用户来重现预期的峰值负载。
根据我的(松散)计算,在峰值负载期间,我需要每个蝗虫用户能够每 2.67 秒向我的 api 发送 http 请求。
我是 Locust 的新手,所以我不得不问 - 这个请求率可能吗?
假设,在一个请求期间(高峰时段),api 的响应时间超过 2.67 秒。 Locust 用户是否会在 2.67 标记时发出另一个请求 - 即使它没有收到其先前请求的响应?
对于一些额外的信息,我将使用一组 Azure 虚拟机来生成蝗虫用户。
Is this request-rate possible?
是的!使用 constant_pacing https://docs.locust.io/en/stable/writing-a-locustfile.html#wait-time-attribute 您可以限制单个用户每单位时间可以执行的任务数。
Suppose, during one request (during peak time), the response from the api takes longer than 2.67 seconds. Will the locust user fire another request at the 2.67 mark- even if it has not recived a response from its previous request?
没有。每个用户都是同步的,因此在前一个请求完成之前不能触发新请求。当测试期间延迟可能上升时确保持续吞吐量的最简单方法是预先增加用户数量并调整每个用户的节奏(例如,将用户数量增加一倍并将节奏时间增加到 5.33 秒)。
不要忘记,在大多数现实世界的情况下,当您的系统饱和度如此之高以至于响应时间增加时,发送更多并发请求不太可能产生更高的吞吐量(反而会导致更高的响应时间 and/or错误)。
编辑:如果你想设置全局速率,而不是每个用户的速率,请改为查看 locust-plugins constant_total_ips() 计时器:https://github.com/SvenskaSpel/locust-plugins/blob/master/examples/constant_total_ips_ex.py
我将使用 Locust 在网络上执行一些负载测试 api。我正在尝试计算我需要多少蝗虫用户来重现预期的峰值负载。
根据我的(松散)计算,在峰值负载期间,我需要每个蝗虫用户能够每 2.67 秒向我的 api 发送 http 请求。
我是 Locust 的新手,所以我不得不问 - 这个请求率可能吗?
假设,在一个请求期间(高峰时段),api 的响应时间超过 2.67 秒。 Locust 用户是否会在 2.67 标记时发出另一个请求 - 即使它没有收到其先前请求的响应?
对于一些额外的信息,我将使用一组 Azure 虚拟机来生成蝗虫用户。
Is this request-rate possible?
是的!使用 constant_pacing https://docs.locust.io/en/stable/writing-a-locustfile.html#wait-time-attribute 您可以限制单个用户每单位时间可以执行的任务数。
Suppose, during one request (during peak time), the response from the api takes longer than 2.67 seconds. Will the locust user fire another request at the 2.67 mark- even if it has not recived a response from its previous request?
没有。每个用户都是同步的,因此在前一个请求完成之前不能触发新请求。当测试期间延迟可能上升时确保持续吞吐量的最简单方法是预先增加用户数量并调整每个用户的节奏(例如,将用户数量增加一倍并将节奏时间增加到 5.33 秒)。
不要忘记,在大多数现实世界的情况下,当您的系统饱和度如此之高以至于响应时间增加时,发送更多并发请求不太可能产生更高的吞吐量(反而会导致更高的响应时间 and/or错误)。
编辑:如果你想设置全局速率,而不是每个用户的速率,请改为查看 locust-plugins constant_total_ips() 计时器:https://github.com/SvenskaSpel/locust-plugins/blob/master/examples/constant_total_ips_ex.py