Scaling and Resilience
Goal: Understand when to go beyond a single instance.
Single instance is fine
A single svelte-adapter-uws instance handles tens of thousands of concurrent connections. All the patterns you’ve learned so far work with in-memory state. For most apps, one server is enough.
When you outgrow it
You need extensions when:
- Multiple instances - load balancer + multiple replicas. In-memory pub/sub only reaches local subscribers.
- Persistence - replay buffers vanish on restart. Redis persists them.
- Cross-instance presence - in-memory presence only sees local connections.
- Rate limiting at scale - per-instance limits don’t work when users hit different instances.
What extensions do
Drop-in replacements. Same API, distributed state.
| In-memory | Extension |
|---|---|
platform.publish() | Redis pub/sub - reaches all instances |
| Replay buffer | Redis sorted sets - survives restarts |
| Presence | Redis - aggregates across fleet |
| Rate limiting | Redis Lua script - atomic across instances |
Related guides
- Scaling Guide - step-by-step from single instance to distributed
- Distributed Pub/Sub - Redis pub/sub setup
- Replay and Presence - persistent replay and cross-instance presence
- Observability - monitoring and metrics
- Extensions package - full API reference
Was this page helpful?