Study Notebook / 06
Scaling and Performance
Where the time actually goes, and how you know
Latency is a distribution, not a number. Measure before you fix: percentiles, utilization and the knee, flame graphs, distributed tracing. Then the fixes, in the order they pay off.
- pages
- 100
- sections
- 46
- editions
- Reading, Print, Tablet
Sign in to read it
The whole notebook is free for 7 days. No card, no payment. We ask for an account so the download link belongs to someone.
Sign in with GitHub or GoogleWhat is inside
The full table of contents. Nothing here is hidden: if a section you need is not in this list, the notebook is not the right one and you should not spend a week on it.
- 1. "Slow" is not a bug report
- 2. Latency is a distribution, not a number
- 3. Why P99 is your most valuable customers
- 4. Throughput, and the curve that bends
- 5. Utilization and the knee
- 6. Headroom, and why traffic arrives in bursts
- 7. Never guess. The week spent on the wrong fix
- 8. Profiling, and what a flame graph shows
- 9. Distributed tracing, and why waiting needs it
- 10. What to measure, in what order
- 11. N+1: the shape, not the name
- 12. Indexes: the catalogue, the tree, and the cost
- 13. Composite and covering indexes
- 14. EXPLAIN ANALYZE: deciding instead of guessing
- 15. Connections are not free
- 16. Pooling, and the autoscaler that killed the database
- 17. What caching actually buys
- 18. Invalidation: the second hard problem
- 19. Where the cache lives
- 20. Three patterns: aside, through, behind
- 21. Hit rate, and the four things that move it
- 22. Vertical scaling, and its three ceilings
- 23. Horizontal scaling, and the bill it comes with
- 24. Statelessness is the price of admission
- 25. The load balancer, and five algorithms
- 26. Health checks, and the server that is up but dead
- 27. Read replicas
- 28. Replication lag, and the read-after-write bug
- 29. Sharding, and the key that is hard to choose
- 30. Distributed databases: rent, do not build
- 31. The speed of light, and the latency budget
- 32. CDNs: what goes on one
- 33. The edge, and what it cannot do
- 34. Asynchronous processing: the queue as a latency tool
- 35. What can be made async, and what cannot
- 36. Microservices scale teams, not machines
- 37. What a network boundary costs
- 38. Serverless: the pricing model is the point
- 39. Cold starts, limits, and statelessness
- 40. When serverless fits, and when it does not
- 41. How to answer "how would you scale this?"
- 42. Five traps
- 43. The five rules
- Appendix A. Numbers worth memorising
- Appendix B. Glossary
- Appendix C. Final review
How to read it
Read with a pen. Every notebook opens with a question to answer before you start and asks you to redo the answer at the end, and the margin in the Print edition exists so you have somewhere to be wrong first. The Tablet edition is 16:9 with vector text, so note apps draw on it rather than treating it as a photograph.