Skip to content
Katabench
Try free

Cache the Hot Path

Medium About 55 min Free with an account

The product page hammers the database directly and melts under load. Design a read path with a load balancer, a cache and a replica, while keeping the client off the database.

The brief

Requirement: Serve a read-heavy hot path without melting the database. The product page is the busiest read in the system: thousands of requests fetch the same small set of rows, and today every one of them reaches the database, so at peak it saturates and p99 latency spikes past a second. The database is also a single point of failure: lose it and every product page dies with it.

Design a read path that absorbs the repeated reads, keeps the app tier redundant, and leaves the system of record standing when traffic peaks.

The topology represents responsibilities and interaction semantics. You do not need to choose a specific product, eviction policy, or replication mode. This tier checks structure; the workload model then measures how your design holds up.

Drag components from the palette, wire them together, then Check your design. Prefer to be guided step by step? The first hint holds the guided plan.

Quantitative target

After the structural checks pass, Katabench runs a deterministic workload model. Check runs the public steady-peak scenario; Submit also runs fixed hidden cold-cache and app-failure scenarios. Your design must:

  • Sustain at least 9,500 requests/second with p99 latency ≤ 100 ms.
  • Keep the error rate at or below 0.5% and recover from an injected app failure within 2 s.
  • Stay below 85% modeled CPU/memory, a 5,000-request queue, and $1,800/month modeled cost.

Select a component to change its capacity tier or cache memory. One canvas node is one independently failing instance; add nodes to scale horizontally. Cost is a versioned educational estimate, not a cloud-provider quote.

Rules of the road (security)

  • A client must never connect directly to a database. Route every request through the app tier.

The same topology and settings always produce the same result: the simulator uses fixed workload versions and seeds, never browser or worker wall-clock timing.

How it is graded

You build the design on a canvas, and Katabench checks the topology against the challenge's design rules.

System Design Studio →

Related guides

What it practices

Caching
Put a cache in front of hot reads and decide what stays fresh.

Do these first

Related katas