Step-by-step answer
Stretch 90 min6 stepsMeasure active CPU against wall time
A FastAPI agent turn in three versions (async, sync in a thread pool, blocking inside async) against a local fake model that sleeps 3 to 8 seconds, plus a 50-request load test. The turn is about 2 to 3% CPU; the blocking-in-async version is 40 times slower, and a per-request process_time turns out to measure the neighbours.
Back to the exercise