Delhi runs on shared capacity. A metro platform holds only so many people, an underpass handles only so many vehicles, and the moment demand exceeds the design, the queue spills into places it was never meant to go. Cloud functions have a version of the same constraint, and managing it is one of the most concrete tasks in ServerlessOps. This guide is a seven-step method for working out how much parallel capacity your workload really needs, how much room you have left, and what to do when a slow dependency eats the margin. It uses a laboratory example from the Ops Atlas so every step can be checked against real arithmetic.
Why this one number deserves a procedure
Concurrency means the count of function copies running at the same instant. Every account has a ceiling per region; the example provider in the Atlas write-up of ServerlessOps practice starts accounts at a pool of 1,000. When your demand touches that ceiling, new invocations are throttled. Worse, if one busy function uses the shared pool, an unrelated function that handles payments or sign-ups can be starved, even though nothing is wrong with it. The Atlas lists uncapped concurrency among its anti-patterns because a spike can cascade into an outage of a downstream system.
Step 1: Write down the three inputs
You need the arrival rate in events per second at your busiest realistic moment, the average duration of one run in seconds, and the account ceiling. Use measured values from your logs, not guesses. If you have no logs yet, begin by recording them for a week. A sensible choice for the busy moment is the highest hour in the last month, plus a margin for the next promotion or festival season.
Step 2: Estimate peak concurrency
The rule is simple queueing arithmetic: concurrency is roughly arrival rate multiplied by duration. If 40 events arrive each second and each run lasts two seconds, you need about 80 copies running at once. This is general-purpose maths, not a platform secret, and it works because each running copy is a person standing on the platform for exactly as long as the run lasts.
Step 3: Compare against the ceiling and set a warning line
Divide your estimate by the account ceiling. The entry’s guidance is to let the peak reach no more than roughly 70% of the cap, and to warn once spare room shrinks beneath 30%. In the example, 80 against 1,000 is eight percent, which is comfortable. Write the warning threshold into an alarm now, while the number is far away.
Step 4: Run the slow-dependency experiment on paper
Here is where the method earns its keep. In its lab, the Atlas has a downstream dependency slow from 200 milliseconds to two seconds, a tenfold stretch. The arrival rate stays the same. Using the formula, peak concurrency scales by the same factor: it rose from 84 to 840, leaving only 160 of the 1,000 allowed and thus breaching the thirty percent headroom line. Monthly function cost moved from $58.80 to $531.30 in the same experiment. No error occurred. No alarm tied to failures would have fired. Only the arithmetic, or a headroom alarm, would have warned you.
Do the same on paper for your system: multiply your duration by ten and recompute. If the answer exceeds your ceiling, you have just found the scenario that will bite you first.
Step 5: Decide where to put the caps
Not every function deserves equal access to the pool. Rank them by business importance and give the most critical a reserved allocation, so that it keeps running even when a noisy neighbour spikes. The sheet adds a precise rule: a reservation requires that the unreserved pool remain at least the maximum you are reserving plus one hundred. Put plainly, you cannot reserve your way to zero shared capacity. For the noisy, less important functions, set a maximum so they cannot consume more than a slice.
Pair each cap with a queue in front of the function whenever the work can wait. A queue turns a surge into a line, much as barricades turn a crowd at a station entrance into a snaking row. Messages wait a little longer, but nothing is dropped and nothing downstream is crushed.
Step 6: Align timeouts so slowness cannot multiply
The slow-dependency scenario is made worse by long timeouts, because each stuck run holds a slot for its full duration. Set the downstream call’s timeout below the function’s own limit, and set the function limit to a realistic multiple of normal duration, not the platform maximum of 900 seconds. If the function reads from a queue, the queue’s hidden-message window ought to be six function timeouts or longer, says the entry. These nested limits prevent a downstream hiccup from turning into a concurrency flood.
Step 7: Add alarms and rehearse
Create three alarms: one on remaining headroom under thirty percent, one on the throttle ratio, and one on backlog age for each queue. The Atlas also walks through a throttle calculation. Across 30 million orders it counts 31.5 million runs, which is 1.05 attempts for each order, and 63,000 of those were turned away. That ratio, a fifth of one percent, is the number to compute yourself. The figures are modest. What matters is that a weekly recalculation shows the day they move.
Then rehearse. Use a test environment, add an artificial delay of ten times normal to the dependency, and watch what your alarms do. If headroom falls and the warning fires, your design works. If a critical function is throttled, your reservations need adjusting.
What the evidence says about expected results
A caution about examples: they are tidy, and real systems are not. The Atlas lab is a controlled experiment, so real systems have noise: bursts, retries, mixed workloads. The method is not meant to predict the exact number. It is meant to reveal orders of magnitude and the sensitivity to one input, duration, which is the variable teams most often forget. A tenfold change in duration led to a tenfold change in concurrency and almost a ninefold change in cost, and no component reported an error.
Three mistakes that undo the method
The first mistake is using the average duration when the tail matters. If most runs take half a second but one in twenty takes ten, the slow ones can hold a surprising share of your slots, so use a high percentile for the sizing and the average for the cost. The second is forgetting retries. Each retry is another run, so if your attempt count per event is 1.3 rather than 1.0, your concurrency need rises by the same proportion. The third is sizing one function in isolation. All the functions in the account draw from one pool, so add up the peaks of everything that can be busy at the same time, such as the order handler and the nightly report job that happens to start during a sale.
A fourth, quieter trap is the quota itself. The ceiling can often be raised on request, but that takes time and the provider may ask for justification, so ask well before the festival season, not during it. Keep your calculation in a short document you can attach to the request.
Take the method further
If you are building skills for a role in this area, pair this with broader delivery practice. A programme overview such as a roadmap for learning, practising and growing a delivery career gives context. Anyone planning a visit to the capital for a conference or an interview may also find a breakdown of how many days the city deserves useful, since a good trip plan follows the same logic as a capacity plan: estimate the load, leave margin, and do not schedule to the limit.
A compact recap
- Record arrival rate, duration and the account ceiling.
- Multiply rate by duration for peak concurrency.
- Compare to the ceiling and alarm below thirty percent headroom.
- Stretch duration tenfold on paper and see what breaks.
- Reserve for critical functions and cap the noisy ones.
- Shorten timeouts and nest them.
- Alarm, then rehearse with a slow dependency.
Seven steps, one afternoon, no new tools. The payoff is a number you can defend when someone asks why the system survived the sale.