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 Google

What 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. 1. "Slow" is not a bug report
  2. 2. Latency is a distribution, not a number
  3. 3. Why P99 is your most valuable customers
  4. 4. Throughput, and the curve that bends
  5. 5. Utilization and the knee
  6. 6. Headroom, and why traffic arrives in bursts
  7. 7. Never guess. The week spent on the wrong fix
  8. 8. Profiling, and what a flame graph shows
  9. 9. Distributed tracing, and why waiting needs it
  10. 10. What to measure, in what order
  11. 11. N+1: the shape, not the name
  12. 12. Indexes: the catalogue, the tree, and the cost
  13. 13. Composite and covering indexes
  14. 14. EXPLAIN ANALYZE: deciding instead of guessing
  15. 15. Connections are not free
  16. 16. Pooling, and the autoscaler that killed the database
  17. 17. What caching actually buys
  18. 18. Invalidation: the second hard problem
  19. 19. Where the cache lives
  20. 20. Three patterns: aside, through, behind
  21. 21. Hit rate, and the four things that move it
  22. 22. Vertical scaling, and its three ceilings
  23. 23. Horizontal scaling, and the bill it comes with
  24. 24. Statelessness is the price of admission
  25. 25. The load balancer, and five algorithms
  26. 26. Health checks, and the server that is up but dead
  27. 27. Read replicas
  28. 28. Replication lag, and the read-after-write bug
  29. 29. Sharding, and the key that is hard to choose
  30. 30. Distributed databases: rent, do not build
  31. 31. The speed of light, and the latency budget
  32. 32. CDNs: what goes on one
  33. 33. The edge, and what it cannot do
  34. 34. Asynchronous processing: the queue as a latency tool
  35. 35. What can be made async, and what cannot
  36. 36. Microservices scale teams, not machines
  37. 37. What a network boundary costs
  38. 38. Serverless: the pricing model is the point
  39. 39. Cold starts, limits, and statelessness
  40. 40. When serverless fits, and when it does not
  41. 41. How to answer "how would you scale this?"
  42. 42. Five traps
  43. 43. The five rules
  44. Appendix A. Numbers worth memorising
  45. Appendix B. Glossary
  46. 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.

more notebooks