Module 1 · AI workloads on your platform · Chapter 01 · Free
Why AI workloads break ordinary platform habits
- An AI request is not a quick, stateless web hit. It runs for seconds and holds GPU memory throughout.
- The scarce resource is the GPU, and a few long requests can fill capacity that looks idle on CPU graphs.
- A service can be up, fast, and still wrong, so quality and cost per request are platform signals.
The picture: a web tier is a row of checkout tills. An inference tier is a small kitchen where each order occupies a cook until done.
- Six ways inference differs from ordinary web work, and the habit each breaks.
- A worked comparison of both tiers under the same traffic spike.
- A sorting skill: given a platform surprise, name the habit that caused it.
- The key terms: KV cache, cold start, token shaped load.
Copperline is a made up B2B SaaS company. On launch morning its support copilot goes live for Ana, the support lead. At 9 a.m. traffic arrives, all figures here illustrative.
- Latency climbs. Priya Nair, the staff platform engineer, watches the autoscaler add pods as usual.
- Latency gets worse. Each new pod spends minutes loading multi gigabyte model weights before it can answer.
- The load balancer counts the new pods as ready and sends them traffic, which queues behind a model not yet loaded.
- By 9:40 the team pins traffic to the two warm pods and the queue drains. The platform worked as configured, on web habits.
Nothing was broken in the ordinary sense. The workload was different. This chapter names the differences.
- Differences 1 and 2: long stateful requests, and the GPU as scarce resource.
- Differences 3 and 4: token shaped load, and heavy cold starts.
- Differences 5 and 6: quality as a signal, and cost that scales with success.
- The picture, then both tiers under the same spike.
- A lab: match six surprises to the habit behind each.
Next: why a request is not a quick visit.
Step 1: Requests are long and stateful, not quick and stateless
A web request arrives, replies in milliseconds, and frees everything. An inference request generates text token by token, often for seconds, and the engine holds state for it throughout.
- The state: for each live request, the engine keeps a KV cache, the stored attention data for every token so far, growing as the answer grows. Token basics are in the tokens chapter of the AI engineering course.
- What it breaks: short timeouts, aggressive draining, and the idea that a pod can drop any request at no cost.
- Do instead: treat connections as long lived. Drain slowly, stream responses, and expect memory to rise with live requests.
Think of each request as a phone call, not a letter: the line stays open. Where the picture breaks down:
- A call holds a person. A request holds GPU memory and a batch slot, harder to add mid call.
- Requests can be cut off mid answer, and the partial work is simply lost.
Next: why the GPU fills first.
Step 2: The scarce resource is GPU memory and compute
On a web tier you watch CPU and RAM, which subdivide neatly: ten small containers share one node. A GPU does not split so politely by default. Weights take a large fixed block of GPU memory, and what is left holds the KV caches of live requests.
- What it breaks: sizing by CPU, packing many small replicas per node, and reading a quiet CPU graph as spare capacity.
- Do instead: size from GPU memory first: weights plus cache per request, times promised concurrency. Chapter 9, "GPU sizing: memory math for weights, KV cache and concurrency", does this math in full.
- Do instead: alert on GPU memory and live slots, not only CPU.
Next: why request counts mislead.
Step 3: Load is token shaped, not request shaped
Two requests are not equal load. A short question is cheap. A long document question holds a slot and cache far longer. Load follows tokens and time, not request count.
- What it breaks: capacity plans in requests per second, and load tests sending short, identical prompts.
- Do instead: measure prompt tokens, output tokens, and seconds per request. Test with traffic shaped like real use.
- Do instead: watch concurrency: live requests times average duration is the load your GPUs feel.
Next: the heavy start behind launch morning.
Step 4: Cold starts are heavy, so new capacity arrives late
A web container starts in seconds and serves at once. A serving pod must pull and load model weights, often many gigabytes, into GPU memory before the first token. That can take minutes, on every new pod.
- What it breaks: scaling from zero, fast restarts, and readiness checks that pass when the process is up, not when the model can answer.
- Do instead: gate traffic on a real inference check: ready only when the pod returns a token. Keep a warm floor of replicas for known peaks.
- Do instead: cache weights on the node where you can, so a restart reloads from local disk.
Next: the signal health checks miss.
Step 5: Quality is an operational signal, not only a product concern
A web deploy that is up and fast is usually fine. A model or prompt deploy can be up, fast, and wrong: fluent answers citing the wrong policy. Copperline learned this when a help article edit changed copilot answers with no code deploy.
- What it breaks: green dashboards as proof of health, and shipping model changes on uptime alone.
- Do instead: score a fixed set of real questions on every change and watch that score like latency. The evals chapter covers the method; Chapter 18 of this course puts it in CI/CD.
- Do instead: log model version, prompt version, and retrieved sources per answer, so a drop can be traced.
Next: the difference Greg will ask about.
Step 6: Cost is per request, and it scales with success
A cached web page costs almost nothing per view. Every copilot answer spends GPU seconds, and longer answers spend more. If usage doubles, the GPU bill roughly doubles too. Greg, Copperline's finance partner, asked why a popular feature costs more than an unpopular one. This is why.
- What it breaks: free retries, unlimited internal tools with no budget owner, and success with no cost plan.
- Do instead: meter tokens and GPU seconds per request, team, and feature from day one. Chapter 20, "Token and GPU cost control: budgets, chargeback and waste hunts", builds the full system.
- Do instead: set budgets and alerts before launch, while numbers are small.
Predict first:
It gets worse. Readiness that checks only the process sends requests to pods with no model loaded. The queue grows until weights load or traffic is pinned back to warm pods.
Next: the picture, one request through the serving tier.
Step 7: The picture, one request through the copilot tier
Press Next to walk one request.
- The question arrives and the connection stays open for seconds, not milliseconds, while the answer is generated.
- The gateway routes to an engine with a free slot. Timeouts and draining must respect full generation time.
- Each live request keeps a KV cache in GPU memory. It grows per token and frees only when the answer ends.
- The user sees words as they are made. Slot, cache, and cost all run until the last token.
Next: the same spike, two tiers, in numbers.
Step 8: Worked example, web tier versus copilot tier in one spike
A launch sends both tiers the same spike: 600 extra requests in one minute, an illustrative 10 per second. All figures here are illustrative.
1. The web tier. Each request takes 0.2 seconds. Live requests: 10 per second × 0.2 seconds = 2. Two slots carry the spike, and one small pod has room to spare.
2. The copilot tier. Each answer takes 8 seconds. Live requests: 10 per second × 8 seconds = 80. The same spike needs 80 slots, each holding KV cache on a GPU.
3. The slot count. If one engine, illustratively, runs 20 live requests at once, the spike needs 80 ÷ 20 = 4 warm engines. Copperline had 2, so 40 requests queue, however healthy the CPU graph looks.
4. The scaling trap. Adding 2 engines helps only after weights load, illustratively 4 minutes. Sent traffic early, they add queue, not capacity: the launch morning failure.
5. The cost line. At an illustrative price of $2.50 per GPU hour, 4 engines cost 4 × $2.50 = $10 per hour while the spike lasts. Web pods for the same spike cost a fraction of that, since their requests end in 0.2 seconds.
The traffic was identical. Duration per request made the load 40 times larger, on the expensive resource.
Next: the lab, naming each habit.
Step 9: Hands-on lab, match the surprise to the habit
Why this exercise: incidents arrive as surprises, not labels. Naming the habit points at the fix.
Do this:
Lab: Copperline ran its support copilot, document extraction pipeline and internal coding agents on ordinary web habits, and production sent back twelve surprises. This lab runs in your browser and needs JavaScript enabled.
- Each surprise maps to one difference, and each has a counter: readiness on real tokens, GPU first sizing, token metrics, quality scores, cost meters.
- Real incidents mix causes. Launch morning mixed two: heavy cold starts plus readiness that trusted the process, not the model.
Next: a field note, then mix-ups.
Platform teams adopting inference commonly report the same first lessons: readiness probes that check real generation, GPU memory as the primary capacity graph, and warm replica floors for known peaks. Treat these as shared practice, not measured statistics. Engines in this category, such as vLLM, TensorRT-LLM and SGLang, exist largely to manage batching and cache memory well.
Mix-ups to avoid
- "Low CPU means spare capacity." The GPU can be full while CPU idles. Watch GPU memory and live slots.
- "More pods means more capacity now." A pod is capacity only after weights load and it passes a real inference check.
- "Requests per second is the load." Tokens and seconds per request set real load. Count concurrency.
- "Green dashboards mean good answers." Quality is its own signal. Score real questions on every change.
- "Cost is a finance problem for later." Cost accrues per request from the first user. Meter it now.
Chapter quiz
Score 70% to complete.
Review this chapter in 5 minutes
Watch the whole chapter recapped: six differences from web work, GPU first sizing, real token readiness, and the forty times spike.
- Six differences: long stateful requests, GPU as the scarce resource, token shaped load, heavy cold starts, quality as a signal, cost per request.
- Live requests equal rate times duration. The spike: 10 per second at 8 seconds each needs 80 slots, not 2.
- Size GPU memory first: weights plus KV cache per request times promised concurrency.
- Readiness means returning a real token. A loading pod is a queue, not capacity.
- Score quality and meter cost per request from day one.
Decision rule: before applying an ordinary platform habit to an AI workload, check it against the six differences, and change it where one bites.
Review
Glossary
- Inference
- Running a trained model to answer a request. Example: the copilot generating a reply.
- KV cache
- Stored attention data kept per live request so past tokens are not recomputed. Example: it grows as an answer lengthens.
- Token
- A chunk of text the model reads or writes, roughly part of a word. Example: a long answer is hundreds of tokens.
- Cold start
- Delay before a new pod can serve, here dominated by loading weights into GPU memory. Example: minutes, not seconds.
- Serving engine
- Software that runs the model and manages batching and cache. Example: engines in this category include vLLM.
- Readiness
- Whether a pod may receive traffic. Example: passing only when it returns a real token.
- Quality signal
- A measured score of answer correctness over real questions. Example: a fixed set rescored on every deploy.
- GPU memory
- Memory on the graphics processor where weights and caches live. Example: the first limit an inference tier hits.
Next: "The reference serving stack: from request to token".