Hi there,
I am trying to make a comparison between HTTP and Websockets, but the number of requests per seconds is wrongly reported in the simulation for Websockets.
I simulate n users (n=5), each sending m requests (m=200).
On websockets, I am reported of 2 requests per user ( which is open websocket + close websocket), while actually I think the number of requests reported for each user should be : (2 + m) (open request + m send messages + close request).
Http instead reports m requests per user, which is right.
I dunno know if I’m actually missing some setting to achieve the desired result I need.
I post my code below.
Hope someone can reply soon
HTTP:
class HTTPSimulation extends Simulation {
val httpProtocol = http
.baseUrl("http://myUrl")
.acceptHeader("application/json")
.contentTypeHeader("application/json")
val scn = scenario("HTTP")
.repeat(200) {
exec(http("http_test")
.post("")
.body(RawFileBody("http.json"))
.asJson
)
.pause(200.milliseconds)
}
setUp(
scn.inject(atOnceUsers(5))
.protocols(httpProtocol)
)
}
WEBSOCKET
class A3ESimulation extends Simulation {
val wsProtocol = http.wsBaseUrl("ws://myWsEndpoint")
val scn = scenario("WebSocket")
.exec(ws("connect").connect(""))
.repeat(200, "i") {
exec(ws("send ${i}").sendText(payload))
.pause(200.milliseconds)
}
.exec(ws("close").close)
setUp(
scn.inject(atOnceUsers(5))
.protocols(wsProtocol)
)
}