A p2p(peer to peer) plugin-free video/audio Real Time Communication(short for RTC) had always been a nightmare for developers to implement. This was changed few years back with the introduction of WebRTC - an open source, plugin-free, built into browsers technology.
EasyRTC is a webRTC toolkit/framework which lets you build a webRTC app right out of the box with its powerful and robust client/server side api. Although webRTC apps are p2p, they still require server for signalling(read more). For signaling, EasyRTC uses socket.io built on node.js. So, basically I load tested EasyRTC server’s socket.io implementation.
The setup
I used socket.io-client module to interact/connect with EasyRTC server by writing against their server side API, as documented here. Below is the snippet of simple client I created.
var Client = function () {
/* Some code omitted */
this.connectToServer = function (callback) {
var client = io.connect(
'http://'+SERVER_HOST+':'+SERVER_PORT,
{'force new connection': true}
);
if (!client) {
throw "Couldn't connect to socket server";
}
var msg = {
msgType: 'authenticate',
msgData: {
apiVersion: "1.0.11",
applicationName: "xyz"
}
};
var easyrtcAuthCB = function (msg) {
if (msg.msgType == 'error') {
callback('easyrtc authentication falied');
} else {
// code omitted
}
};
client.json.emit('easyrtcAuth', msg, easyrtcAuthCB);
};
}
Parameters
I made a command line tool in nodejs to ran tests.
node run.js --no-of-connection=700 --no-of-concurrent-connections=[1,5,10]
In above mentioned command you should notice two things, namely, no. of connections and concurrent connection. My system(Intel(R) Core(TM) i5 CPU M 460 @2.53GHz, 4 GB RAM) couldn’t stand more than 700 connections. Server process started consuming 1 GB RAM for more than 700 connections. I will tell you the reason for this later. For now, 700 was suffice for initial testing.
Data collected
After the script was ran several times, I collected the following data each time for different concurrency against same no. of connections:-
Below you can see the data plotted to graph and their analysis:-
Roundtrip time analysis
CPU Analysis
Memory Analysis
The default behavior of EasyRTC server can cause scaling issues. But good news is you can tweak server side events to handle huge traffic.
PS: I did this testing while I was building a p2p video/audio chat app in waartaa during my GSoC.