VinGt22
VinGt22

Reputation: 21

How to create multiple server streams for a single user in gatling grpc load scripts

We are trying to run a response time test or fixed test (ramp-up 10 users for 10 seconds and continue the run with 10 users for 30 minutes and then ramp-down the 10 users in the last 10 seconds) using the below code. Here there are 2 unary request calls and one server streaming call. Below code works fine for unary requests but for the server streaming request "appServerStreamScenario" the below error appears. The first few requests are working fine for example in this case-- its taking 15 users so, for each user; one request is being passed and after that for the second request with the same user it starts throwing the below error.

Please advise if there is any other alternative to achieve this scenario where we want to increase the users for some duration post which we want to continue the test with those users for a certain duration and then finally ramp down the users.

Below is the code which we are trying to use-- Code:

val appServerStreamScenario: ScenarioBuilder = scenario("app Server Streaming Flow")
.exec(
  grpc("app_ExecuteCommand_Request").serverStream(AppMessageRouterGrpc.METHOD_EXECUTE_COMMAND, "appServerStreamReplier_" + randomAlphaNumericString(8))
.start(AppMsg(ByteString.EMPTY, Map("commandname"->"printdata")))
.endCheck(statusCode is Status.Code.OK)
)

val session_server_Scenarios =
randomSwitch(
34.0 -> exec(appEchoRequest).pause(5),
33.0 -> exec(appExecuteTransactionRequest).pause(5),
33.0 -> exec(appServerStreamScenario).pause(5)

)

val SessionServerTransactions = scenario("App_Scenarios")
.during(duration, exitASAP = false){
  tryMax(repeats) {
    exec(session_server_Scenarios)
  }.exitHereIfFailed
}

setUp(SessionServerTransactions.inject(rampUsersPerSec(1) to (2) during (10)).protocols(grpcConf.shareChannel))`


[ERROR] c.g.p.g.g.a.ServerStreamStartAction - 'serverStreamStart-9' failed to execute: Unable to create a new server stream with name appServerStreamReplier_YCD4rXyy: already exists ---- Requests ------------------------------------------------------------------

Global (OK=339 KO=0 ) appEchoRequest (OK=183 KO=0 ) appExecuteTransactionRequest (OK=141 KO=0 ) appServerStreamScenario (OK=15 KO=0 ) ---- Errors -------------------------------------------------------------------- appServerStreamScenario: Failed to build request: Unable to 158 (100.0%) create a new server stream with name appServerStreamReplier_YCD4rXyy: already exists

---- App_Scenarios ------------------------------------------------------------- [--------------------------------------------------------------------------] 0% waiting: 0 / active: 15 / done: 0

The expectation here is to run this code without any errors.

Upvotes: 0

Views: 209

Answers (1)

George Leung
George Leung

Reputation: 1552

You already have a stream with the same name running. Start another stream with a different streamName, or cancel the already running stream.

Upvotes: 0

Related Questions