Architecture in Motion · Episode 017

2,000 ms product search. A 300 ms GC pause. What explains the rest?

Follow one request through our Java server and the inventory service. A slow product search is a symptom; the timeline helps us investigate its cause.

👤 What Asha sees

Search results should show correct product prices and stock. A slow response is not evidence that GC caused the delay.

Same clock · compare these intervals

Teal: whole requestGold: Java pausedBlue: awaiting inventory answer
0 ms

The blue row is how long our server waits for an inventory response. The inventory service can keep working while Java is paused. The gold row is a pause of Java application threads, not the inventory service.

Who is doing what?

Select a component to see its responsibility.

Visual replay only. No live JVM, database, inventory service or benchmark is connected.

Java 21 Generational ZGC: watch a young-generation collection

Generational ZGC was introduced in Java 21. It separates young objects from older ones and can collect the young generation without collecting the old generation every time. Most work is concurrent. In this toy heap, collect six unreachable young temporaries while keeping three reachable young results and three reachable old cache objects. Reachability, not age alone, determines what may be reclaimed. G1 also uses generations.

Young objects and old cache objects are shown separately. This is a conceptual heap, not a measured collector run.

Why a healthy average can hide slow product searches

Constructed set: 98 requests take 200 ms; two take 2,000 ms. Mean = 236 ms; nearest-rank p99 = 2,000 ms. This teaches percentiles, not an observed result. Never average per-server percentiles to obtain a fleet percentile.

Explore allocation pressure without predicting GC pauses

Multiplication counts hypothetical objects, not bytes. Object sizes, lifetimes, heap, collector and CPU also matter. This cannot predict pause frequency or duration and never changes the evidence above.

Does an overlapping 300 ms pause prove the entire 2,000 ms delay was GC?

Keep exploring · original simulation and model limits

The archived original example and controls are preserved separately; the current lesson uses product search. These constructed timelines cannot diagnose a live JVM or demonstrate a measured performance improvement.

Open original Episode 017 lab ↗