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

Sign in and the whole notebook opens, all three editions with it. An account is what makes a download belong to someone.

Sign in with GitHub or Google

Start reading

How to use this book

Start reading

What is inside

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