### General --- - lag in expected output ### General Latencies --- ![[Pasted image 20260529131340.png]] - Most important: - half ns for [[CPU]] register read - 100 ns for RAM ([[Memory]]) / Redis read - 1 ms database insert - [[Storage]]: - 100 µs for read from [[SSD]] - 10 ms for [[HDD]] disk seek ### Higher Fidelity Top End Latencies --- | Latency | Operation | | ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | | 0-1 ns | Accessing [[CPU]] [[Register\|Registers]], [[Clock Cycle]] of a [[CPU]] | | 1-10 ns | L1/L2 [[Cache]] accesses, branch mispredict penalty (20 [[CPU]] [[Clock Cycle\|Clock Cycles]]) | | 10-100 ns | L3 [[Cache]] access (faster end of this range), referencing main memory (slower end of this range) | | 100-1000 ns | [[System Call]] (to [[Kernel]] and back, not counting latency of syscall itself), [[MD5]] hashing a 64 bit number | | 1-10 µs (~ 1K times slower than CPU register access) | Context switching between Linux threads (at least a few microsecs), same with copying 64KB from one main memory location to another | https://aws.amazon.com/what-is/latency/ https://www.cloudflare.com/learning/performance/glossary/what-is-latency/ https://www.youtube.com/watch?v=FqR5vESuKe0&list=PLCRMIe5FDPsd0gVs500xeOewfySTsmEjf&index=3 https://blog.bytebytego.com/p/ep22-latency-numbers-you-should-know