sonny
sonny

Reputation: 13

Load test websocket with continous streaming using JMeter

The WebSocket stream in JMeter is executed only for a frame, I am not able to load test continuous stream using the jars available @ https://bitbucket.org/pjtr/jmeter-websocket-samplers

Jmeter WebSocket jmx When I try triggering the WebSocket request via terminal, it streams output/logs. But in case of JMeter the Websocket runs only for a frame.

WSS request with Port 443:

Thanks for answering the query. Please can you clear some of my doubts: I am trying to load test a scenario where the client is continuously listening to WebSocket.

1 Using a jar file I am able to continuously stream the data when I hit the java jar in the terminal. I can see the data flowing

2. Now I try to replicate the scenario in JMeter, the sampler acts like a request/response, where the connection is lost after the response.

3. Now if I set a loop in JMeter, it does not satisfy the purpose of streaming. It will act as multiple requests sent to the same channel.

Also in the attached image link, the checkbox for Streaming Connection is checked, but it acts like request/response.

Is looping the only option for WebSocket streaming?

Thread Name: Thread Group 1-1 Sample Start: 2017-04-27 17:21:40 IST Load time: 1383 Connect Time: 0 Latency: 0 Size in bytes: 1065 Sent bytes:0 Headers size in bytes: 0 Body size in bytes: 1065 Sample Count: 1 Error Count: 0 Data type ("text"|"bin"|""): Response code: 200 Response message:

[Execution Flow] - Opening new connection - Using response message pattern "" - Using disconnect pattern "" - Waiting for the server connection for 60000 MILLISECONDS - WebSocket conection has been opened - Connection established - Waiting for messages for 60000 MILLISECONDS - Received frame #1 (15 bytes); matched response pattern - Received message #2 (15 bytes); matched response pattern - Leaving streaming connection open

[Variables] - Message count: 2

[Problems]

Response headers:

SampleResult fields: ContentType: DataEncoding: UTF-8

Upvotes: 1

Views: 4672

Answers (2)

mehul poddar
mehul poddar

Reputation: 1

Thank you Peter for your responses on this thread. I have a very similar use-case, just wanted to understand one thing:

If I keep a "Single Read Sampler" within a "Loop", is there a possibility of some messages being lost between iterations of the loop OR is there some sort of buffering/streaming that ensures that between iterations messages are not lost and returned in the next "Single Read Sampler" read?

Thank you in advance for your help on this.

Update:

As expected from Peter's comment on this answer, we do see that frames are read from the input stream one after the other without any drops.

However, we observe that:

  1. Different WS read timeout values affect the reads very differently
  2. For a given connection, if we are expected to receive, say 500 messages, sometime in between, a message is not read by the WS (timeout = 7s) even though the server does push it (within 18ms), due to which the final read count comes as 499. It is seen that this behaviour's extremity depends on the read timeout (even though message is pushed within the timeout).

Has this behaviour been observed anytime before and could you think of any explanation on why this might be happening? Any solution/help on this would be of great help, thank you.

PS: I was unable to add this as a comment, so apologies for posting the query here.

Upvotes: -1

Peter
Peter

Reputation: 847

(I cannot comment, that would have been more appropriate for the first part)

According to the text in your post, you are using https://bitbucket.org/pjtr/jmeter-websocket-samplers, but the logging you posted is not from that plugin but from Maciej Zaleski's plugin....

I'm not 100% sure what you mean with "load test continuous stream", but if you mean that the server is just pushing frames to the client, that can be tested with the former plugin. Just setup a loop with a "Single read sampler"...

Upvotes: 2

Related Questions