Step 2: Capacity and cost

Step 2 of 14. Turn usage into requests per second, concurrency, tokens and a monthly bill, then test which assumption would hurt most.

Capacity and cost in 60 seconds

  • Volume: 12,000 colleagues x 3 questions = 36,000 requests a day, which is 1.0 request per second on average.
  • Peak and concurrency: assume 10x, so 10 requests per second. At 2.5 s each that is 25 in flight, and 70 for a three-tool flow taking 7 s.
  • Tokens: 1,000 in and 250 out per request gives 1.35 billion tokens a month.
  • Bill: £864 a month for generation at the illustrative prices, before retries, embeddings and platform costs.
  • Always validate: every figure is an assumption until a load test says otherwise.

The problem it solves

Headcount is the wrong starting point for sizing. Twelve thousand colleagues do not make twelve thousand simultaneous requests. Some use the assistant once a week, some ask several questions at opening time, and an outage can make thousands ask the same thing within minutes. If you size for registered users you will overbuy in quiet hours and still fall over at 08:00.

Capacity planning turns product requirements into four numbers: arrival rate, concurrency, token volume and money. Each one feeds a different decision. Rate and concurrency size the services and connection pools. Tokens set provider limits. Money sets the budget and the routing strategy.

Step one: daily request volume

Start with who uses it and how often. Store Assist has 12,000 colleagues, and the working assumption is three questions per colleague per trading day.

12,000 x 3 = 36,000 requests a day. That is the anchor for everything else. If a pilot in five stores later shows two questions per person, or five, you rerun the sums with the observed figure and see what moves.

Each planning step narrows the question: from people, to requests, to rate, to concurrency, to tokens, to money.

Step two: average requests per second

Stores trade for 10 hours a day, from 08:00 to 18:00, seven days a week. Ten hours contain 10 x 60 x 60 = 36,000 seconds. Dividing 36,000 requests by 36,000 seconds gives exactly 1.0 request per second.

Does this mean one request per second is enough? No. It is an average over a smooth day, and real traffic is lumpy. Stores open together. A till software update lands and everyone asks about it at once. A point-of-sale outage across a region sends hundreds of colleagues to the same question in a few minutes.

Step three: peak traffic

Choose a peak multiplier from evidence if you have any, and from judgement if you do not. Store Assist assumes 10x the average, which gives 10 x 1.0 = 10 requests per second.

Treat the multiplier as a hypothesis, not a law. If a regional outage can produce a surge that is far larger, the capacity target must reflect it. For a new service you estimate from the usage pattern, then test the estimate against a load test and, later, against real traffic from the pilot.

Step four: concurrency with Little's law

Requests per second and requests in progress are different measures. Little's law links them: the average number in the system equals the arrival rate times the average time each one spends there. Written as a formula, L = arrival rate x time in system.

At the 10 requests per second peak, with an average of 2.5 seconds per simple answer, about 10 x 2.5 = 25 requests are in flight. A three-tool agent flow that checks stock, reads a ticket and writes a reply might take 7 seconds. Then 10 x 7 = 70 requests are in flight at the same moment, which is nearly three times the load on connections, memory and worker slots for the same arrival rate.

Little's law shows why slow flows matter. The same arrival rate holds far more work in flight when each request lasts longer.

This matters more for AI services than for ordinary web pages. Model calls last seconds, agent flows chain several calls, and streaming keeps a connection open even while little data moves. Size on concurrency, not on arrival rate alone.

Step five: token consumption

A second kind of capacity is text. Each Store Assist request averages 1,000 input tokens, which covers the instructions, the recent conversation and the retrieved passages, and 250 output tokens for the reply.

MeasureInputOutputTotal
Per request1,0002501,250
Per day (36,000 requests)36 million9 million45 million
Per month (30 trading days)1.08 billion270 million1.35 billion

These are estimates. Real figures move with prompt size, how many passages retrieval returns, which model is used, retries and conversation length. Keep one more fact in mind: tokens and requests are separate quantities. Providers can cap calls per minute, input tokens per minute and output tokens per minute independently, and any of the three can be the one that bites first.

Step six: the model bill

The illustrative prices are £0.40 per million input tokens and £1.60 per million output tokens. They are not a quote. Use your own contract figures when you have them.

ItemCalculationMonthly cost
Input1,080 million tokens / 1 million x £0.40£432
Output270 million tokens / 1 million x £1.60£432
Model generation total£432 + £432£864

That is the floor, not the bill. Embeddings, retries, other model calls, hosting and monitoring all come on top. That split is the reason to track the two kinds of token apart: output is four times the price per token here, so a verbose reply costs far more than a long prompt of the same size.

As a sanity check, 36,000 x 30 = 1,080,000 requests a month, so generation costs about £0.0008 per request. The target is under £0.03 per resolved question for the entire service, which means generation takes under three per cent of it. The rest of the budget goes on retrieval, platform, evaluation and support handovers.

Step seven: turn it into a capacity plan

Collect the results into one page that other teams can use:

  • Daily volume: 36,000 requests.
  • Average rate: 1.0 per second. Planning peak: 10 per second.
  • Concurrency: 25 in flight for simple answers, 70 for the three-tool flow.
  • Tokens: 1,250 per request, 45 million a day, 1.35 billion a month.
  • Model spend: about £864 a month before overheads.

These decide whether one application instance will do at launch, whether throttling is needed, and whether extra capacity is wanted at predictable peaks such as opening time. They are still a hypothesis. A realistic test has the last word.

Sensitivity: which assumption hurts most

A plan is only as good as its weakest guess, so shake each one and watch the bill. The table changes one input at a time against the £864 baseline.

ChangeNew monthly input tokensNew monthly output tokensMonthly total
Baseline1.08 billion270 million£864
Context grows to 3,000 input tokens3.24 billion270 million£1,728
Usage doubles to 6 questions per colleague2.16 billion540 million£1,728
Both together6.48 billion540 million£3,456
Replies grow to 500 output tokens1.08 billion540 million£1,296

Context growth is the quiet danger. Adding more retrieved passages, longer history or a larger system prompt can triple the input bill without any visible change in traffic. Put a token budget on the prompt and alert when the average moves.

Provider limits at peak

Providers cap requests per minute and tokens per minute. Convert your peak into their units. At 10 requests per second and 1,250 tokens each, you need 12,500 tokens per second, which is 750,000 tokens per minute. Ten requests per second is also 600 requests per minute.

Then add headroom. A factor of 1.5 gives 900 requests and 1.125 million tokens per minute. Remember multipliers hidden inside the flow: if the three-tool agent makes three model calls per question, requests per minute triple and token use rises too. Ask the provider for a limit that clears the headroom figure, and treat a smaller grant as a design constraint that shapes routing and queueing.

Costs outside generation

  • Query embeddings: each question is embedded once to search the index. At roughly 30 tokens per question that is about a million tokens a day, which is small, but cached embeddings still save latency.
  • Indexing and reindexing: embedding the manuals costs money and time. A full rebuild of 20,000 chunks of 400 tokens is 8 million tokens. The money is trivial at typical embedding prices (an assumption to confirm), but the clock time and the risk of a bad index are not. Budget for rebuilds whenever the embedding model changes.
  • Retries and fallbacks: failed calls are paid for twice. Assume a retry overhead, for example 5 per cent, and cap it with a retry budget. That moves the baseline from £864 to about £907.
  • Evaluation: running the golden set on every release and sampling live traffic costs model calls too.
  • Platform and observability: compute, storage, trace retention and dashboards usually exceed model spend at low volumes.

Pool sizing from concurrency

Connection pools follow the same arithmetic. If 70 flows can be in flight at peak and each holds one outbound connection to the model provider while it waits, the provider pool needs at least 70, and 105 with a 1.5 headroom factor. Database and service pools are different because each call is short. Ten flows a second with three lookups of about 0.3 seconds each means 10 x 3 x 0.3 = 9 connections in use on average, so a pool of 20 is comfortable. Always check the limit of the thing at the far end of the pool, not just your own.

Plan the load test

A load test turns assumptions into evidence. Use realistic prompts and a stubbed or sandboxed provider where the real one would be costly. A good plan has five phases:

  • Ramp: climb from 1 to 10 requests per second over 10 minutes and watch where latency bends.
  • Steady peak: hold 10 requests per second for 30 minutes and check p95 time to first token and full answer.
  • Spike: jump from 1 to 100 requests per second in a minute to model the point-of-sale outage, then check queues, limits and recovery.
  • Soak: run at average load for two hours or more to expose leaks and slow growth in memory or cost.
  • Failure: slow or fail the provider mid-test and confirm the fallback behaves as designed.

Write down what each phase must show before you run it. A test with no pass criteria becomes a demonstration.

Store Assist, worked through

At 08:00 a till software update lands in 120 stores. Within five minutes thousands of colleagues ask, "How do I restart the till after the update?" The plan says the service must carry 10 requests per second, with 25 in flight for plain answers. Suppose 40 per cent of the traffic is that single repeated question: only 6 requests per second need fresh generation, and the rest can be served from a scoped cache, which a later step designs.

Now a regional point-of-sale outage doubles the surge to 20 requests per second for ten minutes. The provider cap of 900 requests per minute equals 15 per second, so some work must wait in a queue or take a cheaper route. The plan told us this in advance. That is the value of the exercise: not precision, but knowing which limit you will hit first.

A capacity calculator that exposes assumptions and limits (illustrative) (python)
from dataclasses import dataclass

@dataclass(frozen=True)
class Assumptions:
    colleagues: int = 12_000
    questions_per_day: int = 3
    trading_seconds: int = 10 * 60 * 60     # 08:00 to 18:00
    trading_days: int = 30
    peak_multiplier: float = 10.0           # assumption, validate with load tests
    seconds_in_system: float = 2.5          # 7.0 for a three-tool flow
    input_tokens: int = 1_000
    output_tokens: int = 250
    price_in_per_m: float = 0.40            # illustrative GBP per million tokens
    price_out_per_m: float = 1.60
    retry_overhead: float = 0.05            # extra calls caused by retries
    headroom: float = 1.5                   # safety factor on provider limits

def plan(a: Assumptions) -> dict:
    daily = a.colleagues * a.questions_per_day
    avg_rps = daily / a.trading_seconds
    peak_rps = avg_rps * a.peak_multiplier
    in_flight = peak_rps * a.seconds_in_system            # Little's law
    tokens_per_req = a.input_tokens + a.output_tokens
    peak_tpm = peak_rps * tokens_per_req * 60
    monthly_reqs = daily * a.trading_days
    cost = monthly_reqs * (a.input_tokens * a.price_in_per_m
                           + a.output_tokens * a.price_out_per_m) / 1_000_000
    return {
        "daily_requests": daily,
        "avg_rps": round(avg_rps, 2),
        "peak_rps": round(peak_rps, 2),
        "in_flight": round(in_flight, 1),
        "peak_tokens_per_minute": round(peak_tpm),
        "provider_limit_needed_tpm": round(peak_tpm * a.headroom),
        "monthly_cost_gbp": round(cost, 2),
        "monthly_cost_with_retries_gbp": round(cost * (1 + a.retry_overhead), 2),
    }

if __name__ == "__main__":
    print(plan(Assumptions()))                      # 36,000 / 1.0 / 10.0 / 25.0 / 750,000 / 864.0
    print(plan(Assumptions(seconds_in_system=7.0))) # three-tool flow: 70 in flight

Design decisions

  • Planning peak: pick a multiplier, record why, and name the date by which the load test confirms or revises it.
  • Headroom factor: choose one (1.5 here) and apply it consistently to provider limits, pools and instance counts.
  • Token budgets: set maximum prompt and reply sizes per request type, and enforce them in code.
  • Retry budget: allow retries to add no more than a fixed share of traffic, so a provider wobble cannot double the load.
  • Where to degrade: decide in advance what gives first when a limit is hit, for example cheaper model, shorter context or queued answers.
  • Plan ownership: keep the assumptions in a versioned file next to the code, owned by one team.

Measuring it

  • Tokens per request by route: input and output, as mean and p95. A drift upward is an early cost warning.
  • Peak-to-average ratio: observed against the 10x assumption, per day and per store region.
  • Concurrency over time: in-flight requests, p95 and maximum, per request type.
  • Cost per resolved question: model, retrieval and platform shares, with retry overhead shown separately.
  • Limit utilisation: the share of provider requests-per-minute and tokens-per-minute used at peak.
  • Forecast error: how far monthly actuals differ from the plan, as a cue to refresh assumptions.

When to use it, and how much of it

SituationDepth of planningWhy
Pilot in five storesBack-of-envelope sums and a short testTraffic is small, but you learn the real per-person usage.
Chain-wide launchFull seven steps, sensitivity table and load testA miss shows up on a budget line and in front of colleagues.
Agent flows with several toolsConcurrency and call multiplier firstSlow flows hold resources far longer than simple answers.
Tight provider limitsToken-per-minute analysis and a queue designThe provider cap, not your servers, sets the ceiling.
Seasonal peaks such as promotionsAdd event-specific multipliersThe 10x assumption may be low during a sale.

Trade-offs

DimensionEffectWhat to do about it
HeadroomMore headroom means fewer incidents and higher idle cost.Use a factor you can justify, and review it after launch data arrives.
PrecisionDetailed models take effort and still rest on guesses.Aim for the right order of magnitude, then refine with measured data.
Context sizeRicher prompts raise quality and raise cost per request.Measure quality gains per extra thousand tokens before accepting them.
Peak sizingSizing for every surge is expensive, and sizing for the average fails at 08:00.Provision for the planning peak and queue or degrade beyond it.

What this means for your role

Common mistakes

Step checklist

  • Daily volume, average rate, planning peak and concurrency are written down with their assumptions.
  • Tokens per request are split into input and output for every route.
  • The monthly bill has a baseline, a retry overhead and a sensitivity table.
  • Provider limits are converted to requests and tokens per minute with headroom.
  • Pools are sized from concurrency, and far-side limits have been checked.
  • A load test plan with five phases and pass criteria exists.
  • Spend alerts and a cap policy are agreed and owned.

Further reading

Capacity planning is arithmetic with honest assumptions. Write the numbers down, test them, and revisit them when real traffic arrives. Once you know how much work the system must carry, you can decide how to arrange the parts that carry it.

Next: Step 3: Reference architecture.

Search topics

↑↓ to move · Enter to open · Esc to close