Scaling

Redis Adapter

Socket.IO uses the Redis adapter to synchronize rooms across instances. When enabled, rooms work across multiple server processes.

Multi-Instance Setup

Run multiple server instances behind a load balancer. Forward WebSocket upgrade headers. Session state is in Redis, so any instance can handle any connection.

Sticky Sessions

With the Redis adapter, sticky sessions are not strictly required. Socket.IO rooms work across instances via Redis pub/sub. The load balancer must support WebSocket upgrade forwarding.

Cloudflare SFU

For larger meetings, media can be routed through Cloudflare Workers SFU. You provide Cloudflare credentials; usage is billed by Cloudflare. SFU enables scalability beyond P2P mesh limits.

P2P vs SFU

Mode Participants Infrastructure
P2P Typically up to 5 None beyond signaling
SFU Up to 20+ Cloudflare SFU credentials

Production Recommendations

  • Use HTTPS and a reverse proxy for TLS.
  • Enable the Redis adapter for horizontal scaling.
  • Add TURN servers via rtcConfig.iceServers for NAT traversal.