WebSocket Performance

Long-lived connections.

WebSocket performance characteristics

WebSocket performance is the discipline of accepting that long-lived, bi-directional, stateful connections impose costs unlike request-response HTTP. The cost model is different; the operational shape is different.

Scaling considerations

Scaling WebSockets is its own discipline. File descriptors, memory, kernel tuning all matter; defaults are sized for HTTP, not for hundreds of thousands of long-lived connections.

Operating WebSocket services

Operating WebSocket services is its own discipline. Sticky routing, graceful drain, per-connection metrics all matter; the request-response operational playbook does not transfer.

When not WebSocket

WebSocket is overkill for many patterns. SSE, HTTP/2 streams, and long polling each fit specific cases better; pick the simpler primitive when it works.