Your load test shows the p95 climbing past a second at 80 users per second. Now what? Finding the bottleneck is detective work, and it goes much faster with a method than with guesses.

Start with the shape of the result

Before opening any dashboard, read the run itself:

  • Which step is slow? If only GET /orders degrades while everything else stays flat, the problem is specific to that endpoint: a query, a call it makes, a lock it takes. If every step slows down together, it is shared: CPU, a pool, the database server, the network.
  • When does it start? A sharp knee at a certain load points to a pool or limit being exhausted. A slow drift at constant load points to something accumulating (see soak testing).
  • What errors appear? 502/504 usually mean upstream timeouts; 503 means something is refusing work; 500 with "too many connections" names the culprit for you.

Check the four usual suspects

1. The database

The most common bottleneck by far.

  • Slow queries: enable the slow query log (or pg_stat_statements in PostgreSQL) and sort by total time, not by average.
  • N+1 queries: one request issuing dozens of near-identical queries. Count queries per request in your logs or APM.
  • Missing indexes: run EXPLAIN ANALYZE on the slow query and look for sequential scans on big tables.
  • Locks: concurrent writes to the same rows (counters, stock, balances) queue behind each other.
  • Connections: if the pool is exhausted, requests wait for a connection before running a single query.

2. Worker and connection pools

Every stack has a cap on concurrent work: PHP-FPM max_children, Puma threads, Gunicorn workers, Node's event loop, a JVM thread pool, an HTTP client pool. When it is full, requests wait in a queue, and latency grows while CPU looks fine. Idle CPU with growing latency almost always means a pool.

3. External calls

Payment providers, email APIs, auth services, other internal services. One slow dependency without a timeout holds a worker for as long as it takes. Check:

  • Does every outgoing call have a timeout (seconds, not minutes)?
  • Can it be cached, or moved to a queue?

4. CPU and memory

Real CPU saturation shows as all cores near 100% while latency climbs. Common causes: password hashing at login, JSON serialization of huge responses, image processing, template rendering without caches. Memory pressure shows as swapping or containers being killed and restarted.

Correlate, don't guess

The fastest way to the answer is to put the load test's timeline next to your server's metrics:

  • latency per step;
  • CPU, memory;
  • database connections and query time;
  • queue depth, worker count.

The metric that bends at the same moment as the latency is your lead. Then follow a single slow request end to end with distributed tracing: the trace shows exactly which span ate the time.

Fix one thing, measure again

Change one thing, re-run the identical test and compare against the previous run. If p95 dropped from 1.4 s to 380 ms, you found it. If not, revert and take the next suspect. Changing three things at once tells you nothing about which one helped.

How Hoofbeat helps

Each run reports p50/p95/p99 and errors per step, so you see at once whether one endpoint or everything is slow. Connect Prometheus and your CPU, memory and database series are charted on the same timeline as the load. Hoofbeat tags every request with a trace header, so you can jump from the slowest requests to their traces in Jaeger or Tempo. And the AI diagnosis reads all of it together and suggests the most likely cause, in plain words.