Free preview

Request Types: CPU-, Memory-, and IO-Bound

Why this matters: "requests per second" implies all requests are alike. They are not, and the difference between the cheapest and most expensive class is roughly a hundredfold — which means guessing wrong about your workload's class invalidates the whole estimate.

Key takeaway

Real workloads fall into three categories — CPU-bound, memory-bound, and IO-bound — separated by roughly an order of magnitude each. Knowing which one dominates tells you what resource to buy and what to optimize.

The three classes

Using the latency table from the previous lesson as the reference:

ClassLimited byExampleTimeRelative to CPU-bound
CPU-boundProcessing speedCompressing 1 KB of data3 us1x
Memory-boundThe memory subsystemReading 1 MB sequentially from RAM9 us~3x slower
IO-boundThe IO subsystem (disk or network)Reading 1 MB sequentially from SSD200 us~66x slower

To simplify calculations, these differences are commonly approximated as clean orders of magnitude:

CPU-bound task    = X
Memory-bound task = 10X
IO-bound task     = 100X

The measured ratios (1x, 3x, 66x) are close enough to 1/10/100 for estimation purposes, and the round numbers are far easier to carry through a multi-step calculation.

Identifying which one you have

WorkloadDominant classTell
Video transcoding, encryption, compressionCPU-boundCores are pinned; disk and network idle
In-memory analytics, large sorts, joinsMemory-boundHigh memory bandwidth use; CPU waits on RAM
Serving files, database queries, calling other servicesIO-boundLow CPU utilization while latency is high
Typical web API endpointIO-boundMost time spent waiting on a database or a downstream call

When the workload class shifts

Suppose a service transitions from mostly CPU-bound to mostly IO-bound — a common trajectory as a product grows, since features that once computed in memory start reading from a database or calling other services. What changes in your planning?

Planning dimensionCPU-bound serviceIO-bound service
Per-request cost~3 us — roughly 1,000 requests/sec/core~200 us or worse — orders of magnitude fewer
What to buyMore cores, faster clocksFaster storage, more IOPS, more bandwidth, caching
Concurrency modelThreads ~ cores; more just adds context switchingConcurrency far exceeds cores — threads are blocked, not busy
Server countScales with core countDriven by wait time, not compute — Little's Law governs
Biggest leverBetter algorithms, SIMD, compression choiceCaching, batching, denormalization, fewer round trips
What saturates firstCPU utilizationConnection pool, IOPS ceiling, or NIC

The headline consequence: your per-server request estimate drops by up to two orders of magnitude, so a server count derived from CPU-bound assumptions becomes badly optimistic. But the fix is usually not more servers — it is removing the IO, via caching, batching, and cutting round trips. Recall Little's Law from the previous chapter: with IO-bound work, concurrency must rise to cover the wait, or throughput collapses regardless of how many cores are idle.

Key takeaway

Classify the workload before you size it. A CPU-bound estimate applied to an IO-bound service will be optimistic by up to 100x — and will point you at the wrong hardware to fix it.

Interview signal by level

LevelWhat a strong answer sounds like
L4Treats all requests as equally expensive.
L5Distinguishes them: "this endpoint is IO-bound — it's waiting on the database, not computing."
Staff+Sizes from the class: "IO-bound at roughly 100x a CPU-bound request, so my per-server RPS drops by two orders of magnitude. That means caching and batching before capacity — and concurrency has to exceed core count because those threads are blocked, not busy."

Next: deriving a server's request capacity from first principles.

Enjoying the preview?

Create a free account to unlock the rest of this course, the in-browser judge, and live AI mock interviews.

Sign up free to continue