intermediate

Slow, and Nothing Is Busy

Read the evidence before you read the options. The signals are presented the way a dashboard would present them — nothing is labelled with the answer.

The report

The inventory service started timing out during the afternoon peak. It clears up by evening. The on-call engineer says "all the graphs are green" and has been restarting instances, which helps for about ten minutes.

The system
40 connectionsInventory API ×8Connection poolPostgreSQL primary
Inventory API — during the afternoon peakILLUSTRATIVE
SignalValueWhat it tells you
App CPU14%The application instances are mostly idle.
p99 latency4.8 s (target 300 ms)The slowest 1% of requests take sixteen times the target.
Error rate2.1% (client timeouts)Roughly one request in fifty exceeds the client timeout.
Connection pool in use17 of 40Fewer than half the available connections are checked out.
Pool acquire wait (p99)3 msRequests get a connection almost immediately.
PostgreSQL — same windowILLUSTRATIVE
SignalValueWhat it tells you
DB CPU22%The database server has substantial idle capacity.
Disk read I/O18 MB/s (capacity ~500 MB/s)Storage is barely being touched.
Query execution time (p99)11 msOnce a query starts running, it finishes quickly.
Statement duration (p99)4.6 sThe total time a statement occupies a session is four hundred times its execution time.
Sessions in `LockWaitEvent`31 average, peak 94Dozens of sessions are simultaneously in a wait state rather than executing.
Deadlocks0No deadlocks are being detected or rolled back.
Sample of blocked sessions, captured at 14:41
pid    state                wait_event      duration   query
28841  active               —               00:00:00.9  UPDATE stock SET qty = qty - $1 WHERE sku = $2
28855  idle in transaction  ClientRead      00:00:04.4  (last: SELECT ... FROM stock WHERE sku = $1 FOR UPDATE)
28857  active               transactionid   00:00:04.1  UPDATE stock SET qty = qty - $1 WHERE sku = $2
28861  active               transactionid   00:00:03.8  UPDATE stock SET qty = qty - $1 WHERE sku = $2
28863  active               transactionid   00:00:03.7  UPDATE stock SET qty = qty - $1 WHERE sku = $2
...    (27 more sessions waiting on transactionid, all touching sku = 'SKU-11402')
What is the constraint?