Logging
Latency numbers every programmer should know
| Operation | Category | Typical latency |
|---|---|---|
| Register / increment (1 CPU cycle) | CPU | 0.3 ns |
| L1 cache reference | CPU | 1 ns |
| Branch mispredict | CPU | 3 ns |
| L2 cache reference | CPU | 4 ns |
| Main memory (RAM) access | Memory / OS | 100 ns |
| Context switch | Memory / OS | 1–3 μs |
| NVMe SSD read (4 KB) | Local I/O | 100 μs |
| Roundtrip in same datacenter | Local I/O | 500 μs |
| HTTP call, same region | Network | 10–50 ms |
| Third-party HTTPS API (Stripe, Twilio) | Network | 100–500 ms |
Since logging is a I/O operation - the question is how much are we paying for it?