Before a ticket sale expected to send fifty times normal traffic within a minute, how would you load-test a function-backed API to expose its scaling limits?
answer
- the ramp, not the plateau
- start with nothing warm
- not production's quota pool
- throttles, cold starts, downstreams
basics
~20 sReplay the ramp, not just the peak: climb from normal to fifty times inside a minute, starting cold, in an environment with production's quotas but not its shared pool, and watch throttles, cold-start share, latency and every downstream.
solid answer
~50 sA steady peak test misses the failure that matters, because instances warmed during a gentle climb hide the platform's scale-up rate. So model the real shape: baseline, then the step to fifty times inside a minute, then a hold. Run it where quotas match production but the regional pool is not shared with production, since a test in the production account and region can throttle live functions; check the test environment's quotas first, because a fresh account may start lower. Start with no warm instances, as on launch morning, and drive the load from outside, through the same gateway real users hit. Watch the throttle count, concurrent executions against the quota, the cold-start share and p99 latency per function, plus every downstream. A pass is no throttles on the ramp, not survival on the plateau; a fail tells you whether to raise the quota, pre-start capacity or shape the traffic.
code
yaml · 15 lines# illustrative load profile; keys are made up, not any tool's syntax
startFrom: cold # no warm-up phase before the step
stages:
- hold: 5m
rate: 1x # normal traffic
- ramp: 1m
to: 50x # the launch step
- hold: 15m
rate: 50x # the plateau
watch:
- functionThrottles
- concurrentExecutions
- coldStartShare
- p99Latency
- downstreamErrorsgo deeper
Recall that a load test should copy how fast traffic arrives, not only how high it goes, and that throttles are a separate metric to watch.
Explain why a gentle climb hides the scale-up rate and how to shape a stepped test that starts cold.
Show the operational care: an isolated quota pool with production's limits, a generator that can really produce the step, the real front door, and a reading of the results that names the binding limit.
Decide how much launch risk the test must retire and what it costs to keep a production-like environment with matching quotas for these rehearsals.
## Why a peak test passes and the launch still fails A typical load test climbs slowly to the expected peak, holds it, and reports that the system coped. For a function-backed API that test answers the wrong question. A function platform has two scaling limits: a **regional concurrency quota** (how many executions may run at once) and a **scale-up rate** (how fast new instances may be added). A gentle climb gives the platform all the time it needs to add instances, so only the ceiling is tested. A ticket sale arrives as a **step**: fifty times normal traffic within a minute. That is a test of the slope, and the slow-climb test never touched it. The launch then fails with throttling while concurrency is far below the quota, and the load-test report says everything was fine. ## Designing the ramp 1. **Model the real shape.** Use the last comparable launch, the number of people with tickets in their basket or the marketing send time to estimate the step: how high, how fast, how long. 2. **Start cold.** On launch morning, the hot functions are probably sitting at their normal small fleet. Do not run a warm-up phase that real users will not give you, unless the launch plan itself pre-starts capacity, in which case test with exactly that plan. 3. **Hold a baseline,** then apply the step within the same time window the launch will, then hold the plateau long enough for queues and downstreams to show their behaviour. 4. **Include the real request mix.** A ticket sale is not only the purchase call; it is page loads, inventory checks and payment calls in some ratio. 5. **Repeat at a steeper step** than expected, to learn how much margin there is. ## Where to run it - **Not in production's quota pool.** Where the quota is shared by every function in a region of an account or project, test traffic competes with live traffic and can throttle real users. - **With production's limits.** A separate account or project can have different quotas; a fresh one may start with a lower quota than production. Request matching limits before the test, or the test measures the wrong ceiling. - **Through the real front door.** Drive load from outside, through the same gateway, authentication and edge settings users hit, so their rate limits and timeouts are tested too. - **With a big enough generator.** The load generator must itself produce the step; a single machine often cannot, and a generator that saturates looks like a smooth ramp. ## What to watch | Signal | What it tells you | |---|---| | Throttle count per function | Whether any request was turned away, and when | | Concurrent executions against the quota | Whether throttles were the ceiling or the ramp | | Cold-start share and init time | How much of the ramp's latency is new instances | | p99 latency per function | User experience during the step, not only on average | | Downstream metrics (database, payment API, cache) | Whether the real limit is outside the functions | | Gateway and client error rates | What users would actually see | ## Reading the result - **Throttles only during the step, concurrency well below quota:** the scale-up rate is binding. Pre-start capacity for the window, raise per-instance concurrency where the platform allows it, or shape the arrival. - **Throttles at the plateau with concurrency at the quota:** request a quota increase, with its lead time, or cut duration. - **No throttles but downstream errors:** the functions scaled and moved the bottleneck; protect the downstream before the launch. ## Common traps - A test that is green because the generator could not produce the step. - A test that is green because the hot functions were warm from the previous run; reset between runs. - A test that shares the production pool and causes the incident it was meant to prevent. - A test that reports averages only, so a minute of throttling disappears into a quiet hour. - A test run once, weeks before launch, against code that has changed since. The test is done when it fails in a way you understand and the fix makes that same test pass. Keep the profile and the dashboard: the next launch should start from this evidence, re-run against the code that will actually ship, rather than from a fresh guess about how fast the crowd arrives.
- Why reset the environment between spike-test runs on a function platform?Instances started by the previous run stay warm for a while. The next run then begins with a fleet already sized for the peak, never exercises the scale-up rate, and reports a pass the launch will not get. Wait for the fleet to shrink, or redeploy, before each run.
- The spike test shows no throttles, but the payment provider rejects calls at the plateau. What does that tell you?The functions scaled and the bottleneck moved downstream. More function capacity would make it worse. Protect the provider first: cap or rate-limit the calls to it, queue work that need not finish inline, and agree a higher limit with the provider if the launch needs it.
- A test that ramps up slowly to the peak proves the launch will hold.
- Running the spike test in the production account and region is fine because it is brief.
- Warming the functions by hand before the test makes the result more realistic.
- Watching the function error rate alone is enough to judge the test.
- If the functions scale, the downstream services will scale with them.