JMeter - Opening multiple websocket connections in parallel - websocket

The application that I am testing has multiple WebSocket sub-protocols. So, is there a way to open multiple websocket connections in parallel using JMeter?
My current test plan looks like this:
Thread Group
\_ Websocket Open connection 1 (with subprotocol 1)
\_ Websocket request-response samplers
\_ Websocket Open connection 2 (with subprotocol 2)
\_ Websocket request-response samplers
But when I open connection 2, connection 1 is automatically closed. I am looking for some way to hold both open simultaneously. Any help is appreciated!
Please note that I am using Peter Doornbosch's JMeter WebSocket Samplers (from https://bitbucket.org/pjtr/jmeter-websocket-samplers/src/master/).
Thanks in Advance.

When WebSocket Open Connection sampler is invoked it instantiates WebSocketClient establishing the connection with the backend and puts the instance into Thread-Local storage
If there is an active connection at this phase - it will be closed.
So you cannot have > 1 websocket connection for 1 JMeter Thread (virtual user)
The options are in:
Just remove Websocket Open connection 2 (with subprotocol 2) along with its Websocket request-response samplers and parameterize subprotocol using i.e. CSV Data Set Config so 1st virtual user will establish connection with subprotocol 1 and 2nd virtual user will go for subprotocol 2
Put your construction under the Parallel Controller
Not knowing the full context it's hard to recommend something, personally I would go for option 1

You could try the (experimental) multi-connection support that is available on a separate branch, see https://bitbucket.org/pjtr/jmeter-websocket-samplers/src/multiple-connections/. The readme explains how to use it. You'll have to build the plugin yourself, but that's fairly easy and also documented in the readme.

Related

Multiple Parallel Websocket connections to SignalR hub in JMeter

We are trying to load test our login workflow, by simulating 50+ users logging into our front-end, via the API calls. As part of the login process, we make a websocket connection to a SignalR hub(Connect). We then send a call over the websocket connection to a custom endpoint in SignalR(Login), used to add some data to the Redis cache, then do some stuff which isn't important, then send a call to a different custom endpoint over the websocket connection(Logoff) and then Disconnect the websocket connection.
So my question is multi-part:
How do we create a websocket connection from within JMeter?
How do we make a call to a custom endpoint over the websocket connection in JMeter
How do we do this for multi users simulated to be running in parallel, so we can test the load? In other words, we need multiple websocket connections open / alive from JMeter so we can test the load.
Note: Please be aware, I'm asking this on behalf of the load tester/JMeter developer, but because they are new to Stack Overflow, and I understand the SignalR side, I've been asked to log it. I know zip about JMeter, so please handle me like a noob trying to help someone solve a frustrating but important problem.
JMeter per se doesn't support WebSockets, you will need a special plugin if you want to enable this functionality.
The most advanced, comprehensive and supported as of now is JMeter WebSocket Samplers by Peter Doornbosch, it can be installed using JMeter Plugins Manager
Once you install the plugin and restart JMeter you will see several new samplers which will allow to open connection, send request, read response, and close connection.
Unfortunately I cannot guide you further because I don't know the specifics of your application, just look into your browser developer tools or other sniffer tool and configure JMeter to send the same requests as your browser (or other application) does.
More information:
Test SignalR Performance with JMeter
JMeter WebSocket Samplers - A Practical Guide
samples directory contains several example test plans covering different scenarios

How to use existing websocket connection to another websocket request in jmeter?

How to use existing websocket connection to another websocket request in jmeter?
When I tried to use existing connect then as result it show me an error "Sampler configured for using existing connection, but there is no connection" . Please refer attached screenshot.
enter image description here
enter image description here
It looks like you're using 2 different WebSocket Samplers implementations:
JMeter-WebSocketSampler
and JMeter WebSocket Samplers
Your WebSocket Single Write Sampler:
Doesn't know anything about the connection established by the WebSocket Sampler
The WebSocket Sampler closes the connection after receiving the response
So if you want to continue with the WebSocket Single Write Sampler you need to:
Use WebSocket Open Connection sampler to establish the connection:
In the WebSocket Single Write Sampler tick use existing connection box
More information: JMeter WebSocket Samplers - A Practical Guide
If you want to continue with the WebSocket Sampler - tick Streaming connection box:
and remove the WebSocket Single Write Sampler and friends from the Test Plan

In jmeter, how can I keep a websocket connection for later use

I just have a load test in JMeter, in the test, the client will send several requests in few seconds. But I find a problem when the client makes a new request, the JMeter will close the former connection and create a new connection, I just want to reuse the former connection to send a request to the WebSocket server.enter image description here
Just tick use existing connection box in your WebSocket Samplers and the connection established by the WebSocket Open Connection sampler will be re-used
I believe the connection doesn't survive Thread Group iterations (it's basically re-established when Open Connection sampler is executed 2nd time, if you need to repeat the request more than once - either go for Loop Controller or put the Open Connection sampler under the Once Only Controller
More information: JMeter WebSocket Samplers - A Practical Guide

JMeter - I need to open and keep multiple websocket connections at the same time to be able to use them in parallel in JMeter

I am using JMeter to test our websockets server API and now I have the following issue. I need to open and keep multiple WS at the same time to be able to use them in parallel.
JMeter WebSocket Samplers plugin provides possibility:
To open a WebSocket connection via WebSocket Open Connection sampler
And then you can re-use the connection in the following Samplers which will be doing the real work: read, write
When you don't need the connection anymore you can use WebSocket Close sampler
The connections are established "per thread" (virtual user) so provide necessary amount of concurrent threads in the Thread Group and make sure to specify enough loops or the desired duration of the test
More information: JMeter WebSocket Samplers - A Practical Guide

does usual ftp server need two threads for data connection and control conection?

I'm trying to write standard FTP server.
I wonder whether this scenario is correct or not?
1. On each request of clients, a thread manager makes thread for control connection.
2. When control connection thread receives PORT command, it establishes data connection(active open)
Is this usual solution? I wonder this since I have to create standard FTP server.
I would be happy if you answered JUST 'yes' or 'no'.
Thank you in advance.
Yes, FTP uses two connections, read the RFC http://www.ietf.org/rfc/rfc959.txt, the wikipedia article is a bit friendlier http://en.wikipedia.org/wiki/File_Transfer_Protocol but the RFC is the bible.
As far as threads go you will need a thread to listen for incoming connections, a thread to process the control connection and a thread to process the data connection. You could do it all with one thread by using asynchronous i/o using select.

Resources