Chapter 15: Performance and cost

To measure anything you need to say what you are measuring, and "fast" hides two different things.

Latency and throughput

Latency is how long one thing takes. Throughput is how many things get done per second. They are separate numbers, and improving one can hurt the other: waiting to send items in a batch gets more done per second, and makes each item wait longer.

Tell an agent to make something faster and it has to guess which you meant. Batching can be a real win for a nightly import and a real slowdown for the person waiting on one request, and both get described as a speed-up. Name the number you want to move.

Say it to your agent

“The problem here is p95 latency on GET /orders, not throughput, so don't add batching. Measure p95 at 50 requests per second with k6 before and after, and report both.”

The workshop

Name a word, or describe what you mean in everyday language.