AlgoViz

Debug a latency spike

easy 16 min

A p99 alert fires and users say checkout feels slow.

Where it shows up

The same pattern appears across everyday software.

  • Bad deploy

    A new release adds an extra query per item (an N+1 pattern); p99 climbs with cart size. A canary comparing old and new versions catches it early.

  • Saturated pool

    A connection or thread pool runs out, and requests queue. CPU looks normal, so only saturation metrics and traces show the wait.

  • Slow dependency

    A third-party API slows down and, without a timeout, ties up workers in every service that calls it.

  • Garbage collection pauses

    A memory-heavy change causes long GC pauses; latency spikes line up with GC logs and affect all endpoints on a host at once.

  • Fast queries behind a slow checkout

    At the same request rate, checkout p99 rises while query execution time barely changes. Trace the time before the query starts. Compare checked-out connections, pool wait and downstream limits by release. Increasing pool size may worsen database contention. Restoring a leaked lease or limiting fan-out can shorten the queue without increasing database concurrency.

  • Verifying the intervention

    Restore lease cleanup and compare pool waits and end-to-end tails under matched traffic. If waits stay low but execution gets longer, examine plans and changed query mix at the same endpoint.