boomer icon indicating copy to clipboard operation
boomer copied to clipboard

负载变化时导致并发突增

Open daocoder2 opened this issue 3 years ago • 3 comments

locust version: 2.8.0 boomer: master

locust原生界面记录: 阶梯负载

实际压测工具集成展示(tcp连接监控): 工具实际连接

看了些源码,原因可能是这里。不知道是否有后续解决方案?

// TODO: Since locust 2.0, spawn rate and user count are both handled by master. // But user count is divided by user classes defined in locustfile, because locust assumes that // master and workers use the same locustfile. Before we find a better way to deal with this, // boomer sums up the total amout of users in spawn message and uses task weight to spawn goroutines like before.

daocoder2 avatar Aug 30 '22 13:08 daocoder2

有关联,但跟你理解的可能不一样。

  1. locust 阶梯式变化的是并发数,不是负载,落到 boomer 这边,是用 goroutine 实现。
  2. 目前在实现递增的时候,会先关掉之前的 goroutine,但不一定能及时反映在连接数的变化上。你可以理解为这些连接还存在,但是实际并发在工作的,没有这么多。
  3. 后续在完善递增和递减的时候,确实可以做的更平滑一点,不用全关再全开,就是我在注释里面留的 TODO。

myzhan avatar Aug 30 '22 15:08 myzhan

平滑对用户数进行调度,在httprunner中有个版本的实现,可以借鉴下,不过对已有的改动比较大。

daocoder2 avatar Aug 31 '22 10:08 daocoder2

主要的问题不是平滑,而是 locust 下发的消息里面,是根据 locustfile 声明的 class 名来分配的,这样就要求 locustfile 和 boomer Task 里面声明的一致了,使用起来不方便。我想先改 locust,将从 locustfile 读改成从 client ready 消息读。

myzhan avatar Aug 31 '22 14:08 myzhan

目前已经实现。

myzhan avatar Oct 24 '23 13:10 myzhan