我想要实现什么?
对于每个用户,我想创建多个服务器流,并且对于每个流,我想确保收到的响应具有特定状态。
我看到了什么行为?
用户能够成功创建第一个流,但在创建后续流时遇到以下错误。
Unable to create a new server stream with name stream1: already exists 12:07:56.809 [gatling-1-1] ERROR c.g.p.g.g.a.ServerStreamStartAction - 'serverStreamStart-2' failed to execute: Unable to create a new server stream with name stream1: already exists
我尝试了什么? 请参阅下面我的代码的摘录
class StreamingSimulation {
private final val sc = scenario("simulation-lt-scenario")
.feed(
feederFor("payload", requestHelper.getStreamingRequest()
)
.exec(
grpc("action request").serverStream("stream1")
.start(GrpcService.getMyStreamingMethod)($("payload"))
.check(extract { r: MyResponse => Option(r.someState) } is STATE_A))
)
setUp(
scn.inject(rampUsers(1))
. throttle(
reachRPS(throttleRPS) in (60 seconds)
holdFor(300 seconds)
)
.maxDuration(300 seconds)
.protocols(grpc(configureChannel(config)))
)
}
看起来用户不应该使用此设置创建超过 1 个流。我想知道是否可以采取另一种方法来实现我想要的行为?
在这里-- grpc("action request").serverStream("stream1") 您可以尝试将时间戳附加到服务器流名称,以便它每次都会获得一个新的流名称,如下所示--grpc("action request") .serverStream("stream1_" + 时间戳)
我们遇到了同样的问题并尝试了这个选项,但我们仍然停留在这一点上。您可以尝试此建议,看看这是否可以为您解决问题,或者是否已经通过其他方式为您解决了问题,请告诉我们。
我在使用 Loop 时也遇到了这种行为(forever、period、repeat),如果可以的话避免使用这些。
此外 throttle 尚不兼容流,仅 UNARY(至少目前如此),您可能会过早地遇到超时。
希望这有帮助!