How to do load testing for websockets

Pankaj picture Pankaj · Sep 26, 2012 · Viewed 32.8k times · Source

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.

Answer

Laksitha Ranasingha picture Laksitha Ranasingha · Apr 25, 2013

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 ?