如果用户数量少于蝗虫的孵化率,会发生什么情况

问题描述

我正在使用Locust对应用程序进行负载测试,但是我需要使用一个用户来测试我的应用程序,方案是我有一个用户,因此我需要多次执行一些api。 因此,在蝗虫中,这两个参数是用户数量和孵化率,因此在我的情况下,这两个参数的值是多少。 如果我保持用户数= 1,我的孵化率值应该是多少? 并且如果用户数= 1且孵化率= 10,那么从蝗虫的角度来看这意味着什么?

from locust_base import LocustBase
from locust import HttpUser,TaskSet,task,between,SequentialTaskSet,events


class LoadTestSummary(LocustBase):

    @task()
    def get_org_summary(self):
        response = self.client.get(url)
        if response.status_code != 200:
            raise Exception('Failure in org summary call. {}: {}'.format(response.status_code,response.text))


class TestScenario(HttpUser):
    tasks = [LoadTestSummary]
    wait_time = between(5,9)
    host = "https://google.com"


users = 1
hatch-rate = 10

解决方法

用户数是最大值,并且不受孵化率的影响。

例如,如果您使用locust -u 1 -r 10000,您仍然只会获得1个用户。就您而言,根本不需要设置孵化率。