The problem

“The API is slow” arrives as a complaint, not a measurement. The channel team blames integration. Integration blames the backend. The backend team shows a dashboard where everything is green. Days pass in meetings.

The argument ends when someone puts numbers on each hop of one real request. This playbook is a method for doing that in hours, and a list of the causes that account for most slow integrations.

Step 1: Time every hop of the same request

You need one identifier that travels with the request, and one log line per hop that records how long that hop took.

  • One correlation ID. Created at the edge, forwarded in a header on every call, written in every log line. If a hop drops it, fix that first.
  • Two timestamps per hop. When the request arrived and when the response left. The difference is the total time. Subtract the time spent waiting on the next hop, and the remainder is the time that hop spent on its own work.
  • Queue time, separately. Record how long the request waited for a thread or a connection before work began. This number is usually missing, and it is usually the answer.
One structured log line per hop (illustrative)json
{
  "correlationId": "c1b7e0f2",
  "hop": "integration",
  "operation": "getAccountSummary",
  "totalMs": 1840,
  "waitForConnectionMs": 1310,
  "downstreamMs": 420,
  "ownWorkMs": 110,
  "requestBytes": 512,
  "responseBytes": 48210
}

In this example the backend answered in 420 ms. The request spent 1,310 ms waiting for a free connection. The backend dashboard is green and the user still waits two seconds.

Step 2: Read the shape of the slowness

Look at the distribution, not the average. The pattern tells you where to look.

What you seeLikely causeFirst check
Every request is slow, even at low loadWork on the path: serial calls, large payloads, a slow query.Per-hop own-work time for a single request.
Fast when quiet, slow when busySaturation: a pool, a thread limit or a queue is full.Wait-for-connection time and pool usage at peak.
Mostly fast, a few very slowTimeouts and retries, pauses, cold connections.The slowest 1% of requests, one by one.
Slow in steps (1 s, 3 s, 5 s)A fixed timeout or retry delay somewhere.Search configuration for those exact values.
Slow after a quiet periodConnections closed by an idle timeout and rebuilt.Connection setup counts after idle time.

Step 3: Check the usual suspects

These account for most of the cases. Check them in this order, because the first ones are the cheapest to confirm.

  1. Connection pool too small, or connections not returned

    Requests queue for a connection while the backend sits idle. Look for wait time before the call starts. A pool that never shrinks back usually means a code path that fails to release.

  2. A new connection for every call

    Each call pays for a network handshake and a security handshake before any work. Reuse connections. On an internal call this alone often removes most of the latency.

  3. Calls made one after another that could run together

    Three independent lookups at 300 ms each take 900 ms in sequence and about 300 ms in parallel.

  4. The same reference data fetched on every request

    Branch or store lists, product codes and currency tables rarely change. Cache them with a short expiry.

  5. Payloads far larger than the consumer needs

    A response of several hundred fields, parsed and transformed in full so that the channel can show five. Trim at the source, or add a field selection.

  6. Synchronous logging of full payloads

    Writing every request and response to disk inside the request path. Log asynchronously, and log sizes and identifiers by default, not bodies.

  7. Hidden retries

    A client library that silently retries turns one slow call into three. Look for attempt counts above one.

  8. Name resolution and certificate checks on each call

    Lookups that should be cached and are not. They show up as a steady extra delay on the first call of each connection.

Step 4: Fix in order of cost

FixEffortTypical effect
Reuse connections, size the poolConfigurationLarge, immediately.
Align timeouts, remove hidden retriesConfigurationRemoves the slowest outliers.
Cache reference dataSmall changeRemoves whole calls.
Parallel callsFlow changeCuts path time to the slowest branch.
Smaller payloadsContract changeSteady gain, needs consumer agreement.
More capacityCostLast. It hides the cause and it returns.
Change one thing, then measure again

Three fixes applied together leave nobody able to say which one worked. Keep the before-and-after numbers for each change. They are the evidence for the next budget conversation.

Step 5: Keep it fixed

  • Give each hop a latency budget. Write it in the interface agreement. A hop that exceeds its budget owns the problem.
  • Alert on the slowest 1%, not the average. Averages stay calm while a share of users waits ten seconds.
  • Put pool usage and wait time on the dashboard. Saturation shows there before users notice.
  • Run a load test in the pipeline for the few operations that carry most of the traffic, and fail the build if the budget is broken.

Pitfalls

  • Trusting each team’s own dashboard. Each one measures from inside its own system. The waiting happens in between.
  • Testing with one user. Saturation problems do not exist at a load of one.
  • A test environment that is nothing like production. Smaller pools, no security handshake, empty tables. Measure in production with real requests where you can.
  • Raising timeouts to make errors disappear. The errors become slow successes, and threads stay busy for longer. Saturation gets worse.

Checklist

  1. Confirm the correlation ID reaches every hop

    Pick one slow request and find it in every log.

  2. Build the per-hop table for that request

    Total, wait, downstream and own work for each hop.

  3. Match the pattern to the table in step 2

    Decide whether you are looking at work, saturation or outliers.

  4. Walk the suspects in order and fix the cheapest first

    One change at a time, measured.

  5. Record the budget per hop and alert on it

    So the next slowdown is found by an alert, not a complaint.