Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do load testing for websockets [closed]

We are building a group chat feature, which is using websockets. We want to test how many connections our current infrastucture can support.

Basically it boils down to how to simulate a websocket.

like image 543
Pankaj Avatar asked Sep 26 '12 14:09

Pankaj


People also ask

How do you load test WebSockets?

You can use a load-testing tool for that. I have used WebLOAD in a similar project. It records the web traffic when using the browser - it records regular HTTP requests and also the web-sockets traffic - you can then play the script back with many users and measure the server's behavior.

When WebSocket connection is closed?

The WebSocket is closed before the connection is established error message indicates that some client code, or other mechanism, has closed the websocket connection before the connection was fully established.

Does JMeter support WebSocket?

Apache JMeter™ doesn't support the WebSocket protocol out of the box. However, there are a couple of plugins we can use to help with that. One of them is the JMeter WebSocket Sampler by Maciej Zaleski, you can learn how to use it in this blog post. Another great plugin is JMeter WebSocket Samplers by Peter Doornbosch.


2 Answers

I can give you a suggestion from my recent experience. You can connect webkit based Phantom virtual clients to your chat server and measure the resource usage (i.e CPU, memory, may be using a shell script or another utility or you can profile your service )

var system = require('system'); var page = require('webpage').create(); page.viewportSize = { width: 1024, height: 768 };  page.open("<URL to chat server service>", function (status) {     // Check for page load success     if (status !== "success") {         console.log("Unable to connect");         phantom.exit();     } else {         console.log("Client connected  ");         //after connecting you may extract further information, taking screenshots etc. refer the phantom.js API for further details     } }); 

Do you use any framework like socket IO for websocket communication ?

like image 127
Laksitha Ranasingha Avatar answered Oct 08 '22 01:10

Laksitha Ranasingha


Several years have passed, there is another new tool to do load testing for Websockets: https://github.com/observing/thor

like image 32
cooler Avatar answered Oct 08 '22 00:10

cooler