作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想模拟尖峰流量,例如:
T0
时即时孵化 50 个)T+5
即时孵化 +50)T+10
时即时孵化 +50)是否可以创建相同数量的用户,而不是每秒创建一次,改为每 xx 分钟创建一次?
最佳答案
没有这样的内置功能(https://github.com/locustio/locust/issues/1353 如果实现的话可能会解决这个问题)
一种解决方法是立即生成所有用户(使用大约 100/s 的生成速率),并让他们休眠直到运行时间:
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
...
你或许可以做一些聪明的事情并将其全部放在一个类中,但我会把它留作练习 :)
关于python - Locust 负载测试 - 将孵化率从几秒更改为几分钟?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62872079/
“孵化”是什么意思?好吧,我知道这个词是什么意思,但为什么将文件命名为“incubating-log4net-1.2.10.zip”Apache?log4net 是否仍在开发中,因为最后一个版本是 2
我已经开始将 NetBeans 9.0(孵化)与 Java 10 一起使用。我创建了一个新的测试 Java 应用程序项目,并在创建它时勾选了“使用专用文件夹来存储库”(“\lib”)。我还将 JDK/
我已经开始将 NetBeans 9.0(孵化)与 Java 10 一起使用。我创建了一个新的测试 Java 应用程序项目,并在创建它时勾选了“使用专用文件夹来存储库”(“\lib”)。我还将 JDK/
我是一名优秀的程序员,十分优秀!