Load test WebSocket servers

WebSocket servers fail differently from REST APIs. Connection limits, message backpressure, and broadcast fan-out show up only under real concurrency, and Stresix generates that concurrency from a real server on the same private network as the target.

Stresix run preview chart
A Stresix run preview: virtual users, requests per second, and p95 latency over ten minutes.

What to measure

Connection rate tells you how many clients the server can accept per second. Message round-trip latency shows whether the event loop keeps up. Error rate growth under rising concurrency marks the point where the server starts rejecting work.

How Stresix runs the test

The shooter runs k6 in Docker and targets the app over a private network. Load traffic never crosses the public internet, so measurements reflect your app, not network jitter. Telemetry streams live to the workspace as samples arrive.

Where the recommendation comes from

The run compares the load profile against the tier list and recommends the setup that fits. A WebSocket-heavy workload that saturates CPU points to a larger profile before you pay for it.

k6 WebSocket script
import ws from 'k6/ws';
import { check } from 'k6';

export const options = { vus: 1000, duration: '5m' };

export default function () {
  const url = 'wss://your-app.example/ws';
  const response = ws.connect(url, {}, (socket) => {
    socket.on('open', () => socket.send('ping'));
    socket.on('message', (message) => check(message, {
      'reply received': (value) => value === 'pong',
    }));
  });
  check(response, { 'status 101': (r) => r && r.status === 101 });
}

Frequently asked questions

Does Stresix generate WebSocket connections from a real server?

Yes. The shooter runs k6 in Docker on a real server. Connections come from a real host, not a browser tab.

Can I test a local or private WebSocket endpoint?

Yes. Give Stresix a Docker image or repository and the target runs on the same private network as the shooter.

Which metrics matter most for WebSocket?

Connection rate, message round-trip latency, and error rate under concurrency. Those three expose most WebSocket failure modes.

Related guides

stop guessing your specs. start knowing them.

point stresix at a target and get the number you can deploy on, in one run.

Start a load test