Lesson 22 / Unit 5: Capacity Planning
Capacity Planning
Size each tier from resource budgets, idle baselines, arrival rate and failure headroom. Keep historical measurements separate from verified deployment limits.
Start with the call shape, then measure each tier. “500 calls” does not say how quickly they arrive, how many participants join, which models run, or how much spare capacity you need.
The calculation below is a planning example. It does not certify a 400- or 600-call LiveKit deployment.
Resource Inputs
For each tier, record the idle baseline, marginal cost per call, available budget and first observed failure. Keep configuration and measurement units with the results.
| Resource | Required input | Important distinction |
|---|---|---|
| SFU transport | Range allocations or mux traffic | Socket rows are not necessarily unique ports |
| SFU CPU/network | Utilisation, packet rate, bandwidth | Call shape and relay use change the load |
| Worker memory | Idle PSS plus marginal PSS | Subtract the baseline before sizing |
| Worker descriptors | Per-process counts and limits | A fleet total is not a per-process limit |
| Setup | Sustainable answered CPS | Measure dispatch and startup latency |
The earlier worker case reported 122 MB per call and a 1,549 MB idle baseline. Its full raw sample set is not included here. Use those as historical inputs to understand the method, then measure your own worker.
The earlier port counter needs verification, as explained in Port Capacity. Do not use it as a default SFU limit.
Node Limits
For a resource with approximately linear growth:
call budget = floor((usable resource budget - idle baseline) / per-call slope)Keep units consistent and reserve headroom before calculating the budget. For illustration only, using the historical table’s MB labels:
available memory = 30,000 MBidle memory = 1,549 MBincremental cost = 122 MB/callmemory-only cap = floor((30,000 - 1,549) / 122) = 233 callsThat is a memory-only upper bound before additional headroom. If CPU, network, descriptors or model-provider limits bind sooner, the practical cap is lower. Fit residuals and repeat runs matter: a straight-line extrapolation beyond the measured range is a hypothesis.
Keep alarms on every material resource, even when only one currently limits the node.
Arrival Capacity
In steady state, 500 active calls averaging five minutes imply about 1.67 answered calls per second. At 30 seconds they imply about 16.7. Offered CPS can be higher when calls are rejected or abandoned.
Concurrency and CPS shows how to vary the arrival rate independently. Record setup latency and failure rate at the concurrency you intend to serve; a low-load CPS result does not establish the same rate at peak load.
Fleet Headroom
Suppose a controlled test establishes an operating cap of 400 calls per SFU for your workload. For a 500-call peak:
| Planning condition | Arithmetic | Nodes |
|---|---|---|
| Carry the peak | ceil(500 / 400) | 2 |
| Retain peak capacity after one node is lost | ceil(500 / 400) + 1 | 3 |
The second row is spare capacity, not uninterrupted failover. Active rooms on a failed self-hosted node can be interrupted; reconnect or redial needs its own design and test. See room placement.
Next, account for scale-out delay. If nodes take four minutes to become ready, reserve enough capacity for the increase in active calls during those four minutes. Existing rooms do not rebalance just because a new node joins, so inspect the busiest node as well as the group average.
Repeat the calculation for workers, SIP and any self-hosted models. Provider quotas can be the constraint even when every machine has room.
Repeat Measurements
Save versions, configuration, call shape, raw observations and pass criteria with each capacity claim. Rerun after changes to participants, codecs, model placement, transport settings or major SDK versions.
A useful result states the workload and evidence: “This configuration passed N active calls at R answered CPS, with these latency and audio gates.” The course’s historical counts are examples of what to investigate, not a substitute for that run.
Next: Media Validation checks whether the calls counted as successful carried useful audio.
Common questions
How many concurrent calls can one LiveKit media node carry?
There is no universal call count. Measure your configuration and call shape, including transport mode, participants, CPU, bandwidth and setup rate. The 400-call value here is illustrative.
How much memory does one LiveKit agent call use?
Measured as PSS against active calls, 122 MB per concurrent call on a Python worker, on top of an idle baseline of about 1.5 GB. RSS reported 404 MB per call because it counts pages shared with the forkserver parent in every process.
Should a voice fleet be sized on concurrency or calls per second?
Both, and you should say which one binds. Concurrency sizes carrying (ports, memory, steady CPU); calls per second sizes setup (signalling, dispatch, worker spawn). 500 concurrent five-minute calls need 1.67 calls per second; 500 concurrent 30-second calls need 16.7.
We do this work for teams shipping voice agents: Self-Hosted Voice Agent .
Edit this lesson on GitHub ↗Discussion
Questions, corrections and war stories welcome. Sign in with GitHub to comment.