How to stress test a web application relying on Socket.IO?
carriann last edited by
I developed a web application in typescript relying on a node.js server. Now I want to monitor the load time behaviour under stress accessing it on my public development server by virtual users. The problem is, that after loading the page client code is executed requesting further data from the server using message based communication with Socket.IO. This means the loading process cannot be called finished until all the data has been sent by the server. Upon arrival of all necessary data the client sends a message to the server indicating the end of loading and triggers an entry in a log file on the server which tracks all load durations and number of clients that are simultaneously going through the loading process. This seems to work when I manually start the app with a browser but the message isn't triggered when I use a headless browser let alone virtual users from cloud-based solutions. Only the download of static content together with my client-side script are measured but not the following transmissions by Socket.IO.
What would be a feasible approach I could take in order to make the loading process compatible with such tools? Could I maybe include a string by which the client signals that loading is finished and have the time until its emergence measured by some online tool? Do you maybe know such an application?
You'd do it pretty much the same way you'd load test other interfaces for servers. You need a client that interacts with the server and a way to generate a lot of actions concurrently and for some period of time or repetitions. You could probably roll this solution yourself if you really wanted to or you could try an existing tool like Artillery. They provide a quick write-up using their tool at https://artillery.io/blog/load-testing-socketio-with-artillery .