Formula: Erlang Queue Sizing Systems Engineering Formula
- requestsPerSecond: Requests Per Second (req/s)
- avgServiceTimeSeconds: Avg Service Time Seconds (s)
- workerCountC: Worker Count C (workers)
Size worker pools and call/request queues to stay below the 80% utilization knee.
Offered load is arrival rate times service time, so it describes the work coming in, not the capacity to handle it. With 45 requests per second at 0.4 seconds each the load is 18 Erlangs whether you run 20 workers or 30. Adding workers only changes utilisation and waiting time, which is why the target pool figure stays at 24 while you change the worker count.
Once utilisation reaches 100%, requests arrive faster than the workers can finish them, so the queue keeps growing for as long as the overload lasts. There is no steady average wait to report. At 68 requests per second on 24 workers the page explains that utilisation would be well over 100% and that you need more than 27 workers. Add workers until the error clears.
About one request in eight finds all 24 workers busy and has to queue. The other seven start immediately. Those that wait spend about 67 ms in the queue on average in the default case, which is service time divided by the spare capacity of 6 Erlangs. Averaged across every request, including those that never wait, the delay is the 8.5 ms the page shows.
The same maths applies, which is where Erlang C came from. Enter calls per second, average handling time in seconds and the number of agents. Call centres often work in calls per hour, so divide by the number of seconds in an hour first. Remember that real callers hang up when they wait too long, which Erlang C ignores, so it tends to overstate waits when abandonment is high.
No. Enter the mean time a worker is occupied per request. Erlang C is built around averages and uses the mean service time to describe the whole distribution. A percentile would inflate the load and suggest far more workers than you need. If your latency tail is long, keep the mean and add extra headroom, because the model assumes a gentler spread than you have.
Divide by the number of seconds in the period, but do not stop there. A monthly average hides daily and hourly peaks, and queues form during peaks. Use your busiest hour or minute instead. If you only have daily totals, find your peak to average ratio from monitoring and multiply the average rate by it before entering it.
Only for the CPU bound part of the work. An event loop can hold many requests in flight while they wait on I/O, so concurrency is not limited by thread count in the usual way. Treat each process as one worker and use only the CPU time per request as service time. The waiting time between I/O calls does not occupy the loop.
Because there is less sharing. With two workers at 75% busy, the chance both are busy when a request arrives is high. With 24 workers at 75%, it is much lower, since many independent busy spells rarely line up. For 9 Erlangs on 12 workers the page shows a 26.6% waiting probability, against 12.75% for 18 Erlangs on 24 workers, both at 75% utilisation.
Then the system is closer to an M/M/c/K model, where K is the total capacity including the queue. Some requests are turned away instead of waiting forever, so waits stay finite even above 100% load, but you lose traffic. Erlang C overstates waits for such a system and says nothing about the rejection rate, which is often the figure you most need.
Yes. Every retry is another arrival. If clients retry after a timeout, a slow period turns into extra traffic exactly when the pool is struggling, which raises utilisation further. Measure arrivals at the server, including retries, rather than counting unique user actions. During incidents the retry share can grow quickly, so it is worth checking how much headroom remains at a higher rate.
Anything up to 27 workers is overloaded and the page returns an error. The 75% target suggests 37, which gives 73.51% utilisation, a 5.02% chance of waiting and a mean wait of 2.05 ms. With 34 workers utilisation is 80%, 14.94% of requests wait and the mean wait is 8.79 ms, about the same delay as the default service sees today.
Out of the box the calculator describes a service receiving 45 requests per second, each taking 0.4 seconds of worker time, spread across 24 workers. Multiply the first two and you get the offered load: 45 times 0.4 is 18 Erlangs. An Erlang is simply one worker kept busy all the time, so 18 Erlangs means that, on average, 18 workers are doing something at any instant.
Divide by the pool size and you have utilisation. 18 over 24 is 0.75, which is the 75 % headline. The supporting line for workers needed at a 75% target also reads 24, because the default pool was sized exactly at that target: 18 divided by 0.75 is 24.
None of this needs a queueing model yet. Offered load and utilisation are plain arithmetic. The next two lines do need one: the page reports a 12.75 % probability that a request has to wait and a mean queue wait of 8.5 ms across all requests. Both come from the Erlang C formula, and a later section shows how to reproduce them by hand.
Load depends only on the product of arrival rate and service time. Doubling traffic and halving the time each request takes leave the Erlangs unchanged. That is useful when you are deciding where to spend effort. Shaving 0.2 seconds off a 0.4 second handler does exactly what halving the traffic would do.
Running the calculator with service time set to 0.2 seconds and everything else left at default confirms it. Offered load falls to 9 Erlangs, utilisation drops to 37.5 %, the workers needed at the 75% target fall to 12, and the wait on 24 workers rounds to 0 ms. Cutting traffic to the Light preset of 30 requests per second gives a smaller but similar effect: 12 Erlangs, 50 % utilisation, a target pool of 16 workers, a 0.16 % chance of waiting and a mean wait of 0.05 ms.
Be careful about which service time you enter. It should be the time a worker is actually occupied by one request, measured from when the worker picks the job up to when it is free again. It is not the end to end latency your users see, because that already includes any time spent waiting in the queue. Feeding latency in as service time counts queueing twice and inflates the load. If a worker blocks on a downstream call, that blocked time is part of service time, because the worker cannot take another job while it waits.
Erlang C answers one question: what fraction of arriving requests find every worker busy and have to wait? It assumes random (Poisson) arrivals, exponentially distributed service times, an unlimited queue and nobody giving up. That is the M/M/c model the page title refers to.
The formula takes the load A and the pool size c. You compute A to the power c divided by c factorial, then multiply by c over (c minus A). Call that the top term. Below it you add the sum of A to the power k over k factorial for every k from 0 up to c minus 1, and then add the top term again. The probability of waiting is the top term divided by that whole total.
For A of 18 and c of 24 the result is about 0.1275, which is the 12.75 % the page shows: roughly one request in eight queues at all. The mean wait over every request is that probability times service time divided by (c minus A): 0.1275 times 0.4 over 6, which is 8.5 ms, matching the page. Requests that do wait spend on average 0.4 over 6, roughly 67 ms, in the queue.
That last figure is not printed, but it is often the one users notice. The sums are tedious by hand but easy in a spreadsheet, and most languages have a factorial or gamma function that makes checking the page a few lines of code.
Erlang C waits are very non-linear, and running the page with different pool sizes at the default 45 requests per second shows it clearly.
With 30 workers utilisation is 60 %, the chance of waiting is 0.65 % and the mean wait is 0.22 ms. Queueing is almost absent. At the default 24 workers the figures are 12.75 % and 8.5 ms. Drop to 22 workers and utilisation reaches 81.82 %, the waiting probability rises to 27.81 % and the mean wait to 27.81 ms. At 21 workers, 85.71 % busy, the wait is 52.78 ms and 39.59 % of requests queue.
So removing three workers from 24 multiplies the average wait by about six. Adding six workers to 24 cuts it to almost nothing. The steep part of the curve is near saturation, which is why the last few workers of headroom matter far more than the first few.
Pools gain from sharing. A request only waits when every worker is busy at once, and with many workers that happens far less often than the utilisation figure alone suggests. That is the effect Erlang C captures and a simple utilisation rule misses.
The Busy preset raises traffic to 57 requests per second. Load becomes 22.8 Erlangs on 24 workers and utilisation reaches 95 %. The page then reports a 73.35 % chance of waiting and a mean wait of 244.49 ms, almost thirty times the default, from a traffic increase of about a quarter.
That is what working close to capacity looks like. The pool is still stable, but most requests queue, and short bursts above the average rate will push waits higher still. The target pool line suggests 31 workers to bring 22.8 Erlangs back to the 75% target.
Push traffic further and the page stops producing a result. At 68 requests per second the load is 27.2 Erlangs, more than 24 workers can serve, and the calculator returns an error explaining that the queue grows without limit and that you need more than 27 workers. Erlang C has no steady state once A is equal to or greater than c, so there is no average wait to report.
In a real system something else stops the growth: callers time out, a bounded queue rejects work, or an autoscaler adds workers. If you enter 37 workers for that traffic, the page gives 73.51 % utilisation, a 5.02 % chance of waiting and a mean wait of 2.05 ms.
The page sizes the pool so that offered load fills 75% of it. That is a reasonable single rule, but its effect depends on the size of the pool.
On large pools 75% is generous. With 24 workers the chance of waiting is about one in eight and the average wait of 8.5 ms is a small fraction of the 0.4 second service time. Large pools can run hotter than this before delay becomes a problem.
On small pools the same percentage is much tighter. Set service time to 0.2 seconds and the pool to the suggested 12 workers for 9 Erlangs. The page shows the same 75 % utilisation, but a 26.6 % probability of waiting and a mean wait of 17.74 ms, both worse than the large pool at the same utilisation. Fewer workers means less pooling, so each busy spell is more likely to catch an arrival.
If you run the numbers for a small service and a large one, do not expect the same headroom. Check the waiting probability for the pool the page suggests, and add a worker or two where it is higher than you are happy with.
Every input here is an average, and Erlang C assumes the arrival rate holds steady over the period you are modelling. Real traffic does not. A service averaging 45 requests per second over an hour may see far more than that for a minute at a time.
Size for the busiest interval you care about, not the daily mean. If your monitoring shows a peak minute at twice the average rate, enter the peak rate. Utilisation then doubles, and in the default case 90 requests per second on 24 workers would be well past saturation.
Service time varies too. The M/M/c model assumes the exponential spread you get when most jobs are quick and a few are slow. If your handler has a long tail, for instance a small share of requests that trigger an expensive query, real queues can be longer than the model suggests. If service is very uniform, they are often shorter.
Also check whether all workers are interchangeable. Erlang C pools every worker into one shared queue. If requests are pinned to particular workers by hashing, sticky sessions or separate queues per tenant, the effective pool is smaller than the worker count and waits will be worse.
A practical routine looks like this. Measure the peak arrival rate and the mean time a worker is occupied per request. Enter them and read off the offered load in Erlangs. Note the workers needed at 75% as a starting point.
Next, enter that pool and read the waiting probability and mean wait, then try one or two pools either side of it. You will usually see that each extra worker cuts the wait sharply near saturation and barely changes it once the pool is comfortable. The size where the curve flattens is normally the sensible choice.
Then add room for failure. If one instance can disappear during a deploy or a crash, size so that the pool minus that instance still keeps utilisation below 100% at peak and preferably below your target.
Finally, compare the estimate with what production shows. If measured queue time is far above the Erlang C prediction, look for hidden serialisation: a shared lock, a connection pool smaller than the worker pool, or a downstream dependency that caps throughput below what your workers could otherwise handle.