Numbers to Knowchapter 1 of 4 · 3 lessons
Latency Reference
Orders of magnitude that justify every caching and colocation decision.
Two engineers are arguing about one line that reads a user's settings. Just fetch it from the database. No, cache it.
Neither of them says a number, so the argument goes round. Here are the numbers. From memory on the same machine, 100 nanoseconds. From a database in the same building, 500 microseconds, five thousand times longer. From a database on another continent, 100 milliseconds, a million times longer.
Nothing about the code changed across those three. Only how far the data sat. Every caching, colocation and batching argument you will ever sit through is that same argument, and it is settled by knowing which rung a piece of data is on.
Lessons
3 in this chapter- The Ladder from Cache to Cross-RegionNine orders of magnitude separate an L1 hit from a transpacific round trip.3 min
- Ratios Beat Absolute ValuesHardware changes the digits every year; the powers of ten between rungs barely move.3 min
- Spending Latency Numbers in an InterviewUse the ladder to justify caches, replicas, and async boundaries with arithmetic instead of vibes.3 min