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
Related
I cannot load test the chat application in XMPP server using jmeter, I found all XMPP samplers from connect, login till disconnect as error. Please help!
I get this error in the connect server sampler itself and thereby all samplers are error
Nobody will be able to help without seeing the error details so going forward make sure to include essential information about your test, i.e.
Screenshots of your XMPP Samplers
Output of the View Results Tree listener in screenshot or textual form
Relevant entries from jmeter.log file
In the meantime check out XMPP Load Testing - The Ultimate Guide - it contains comprehensive information on how to configure XMPP Test Elements and simulate different types of events (connect/disconnect, log in, get contacts list, setting status, etc.) as well as example test plans
I am recording our game app using JMeter
And it has an API server, which using the WebSocket's protocol
While meeting that request sent to API server, I always get this message, and can't go further
Is that means I need to modify the original JMeter's source code to walk around this problem? Or any way out? If so, that'd be appreciated.
I don't think you will be able to record and replay WebSocket transport using JMeter's HTTP(S) Test Script Recorder as WebSocket is a different beast, given you have a game application my expectation is that it might be the case application opens a WebSocket connection and re-uses it until the end of session and so you won't be able to mimic this behavior using "normal" HTTP Request samplers as WebSocket assumes either ws or wss protocol.
I would suggest considering one of the following JMeter Plugins:
WebSocket Sampler by Maciej Zaleski
WebSocket Samplers by Peter Doornbosch
Both plugins can be installed using JMeter Plugins Manager:
I want to automate REST API using Jmeter. My requirement is trigger and validate the signals generated from the field.Messages from the field like "communication lost" need to check whether this message reached API or not.These messages are developed using "signalr".Can anyone tell me how can i get the messages from signalr in Jmeter.
As per SignalR main page:
ASP.NET SignalR is a new library for ASP.NET developers that makes developing real-time web functionality easy. SignalR allows bi-directional communication between server and client. Servers can now push content to connected clients instantly as it becomes available. SignalR supports Web Sockets, and falls back to other compatible techniques for older browsers.
So my expectation is that you can use WebSocket Sampler plugin in order to test this functionality. The plugin can be installed using JMeter Plugins Manager, check out WebSocket Testing With Apache JMeter article for comprehensive information on installation, configuration and usage of the plugin for WebSockets load testing.
I am using jmeter for tesing a website. My question is that is jmeter dependant on the internet connection? What if there is no internet connection? Will jmeter be able to send requests?
If you are running Jmeter locally, yes -- the overall load capacity of your test is entirely dependent on your Last Mile connection. But if you don't want to fork out the $$$ for your own OC-3, you can look to hosted Jmeter solutions providers -- basically Jmeter as a Service.
JMeter just captures the web requests and mimics the behavior, helping you automate the requests. As you are simulating web requests, you need connectivity to your web application. If you have your website hosted locally in that case you don't need internet connection, but you will surely need a way to reach the website wiz. LAN.
Again the results will vary based on the network bandwith, latency etc. If there is no internet connection and if your browser is not able to make request to your site, then JMeter will also not be able to reach the site and won't be able to make request.
I'm trying to stress test my WebSocket server using Jmeter's plugin (jmeter-websocket). The thing is that the plugin comes with no documentation how to work with it and thus I'm not sure if my expectations of it is supported or not.
I managed to run a sample test using the mentioned plugin and it was successfully connected to server. It also managed to communicate with server but once it was done receiving the first response it disconnected. I was hoping to configure this plugin in a way so it will maintain a persistent connection with WebSocket server for several minutes, sending and receiving a couple of messages before it is disconnected.
By stress testing I would like to see how the number of concurrent connections affect my application's behavior. Is this plugin suitable for my needs? If it is then how should I work with it?
I had exactly the same problem. the plugin you have mentioned worked only for a HTTP-like request/response but I couldn't use it for a "long" connection.
Have a look at this http://github.com/maciejzaleski/JMeter
Features:
Supports HTTS/HTTPS (ws/wss) version of the WebSocket protocol
Option to ignore SSL certificate errors
Streaming allows for a single connection to remain open for the duration of the test
Response has to match predefined regular expression
Response timeout
Response message backlog (build the Sampler response from multiple server messages)
Connection could be closed if server sends a message matching predefined regular expression
As of November 2017, the best Websocket Sampler for Apache JMeter is this 3rd party plugin:
https://bitbucket.org/pjtr/jmeter-websocket-samplers
It can easily be installed through jmeter-plugins plugin manager.