WRITELOOP

LATENCY NUMBERS CHEATSHEET

Here is a reminder of some latency numbers we developers must have in mind when drafting our solutions/algorithms.

2022 September 22

Seconds scale:

  • ns: nanoseconds
  • us: microseconds
  • ms: miliseconds
  • s: seconds

(TL;DR:  ns --> us --> ms --> s)

1 ns = 10^-9 seconds
1 us = 10^-6 seconds = 1000 ns
1 ms = 10^-3 seconds = 1000 us = 1000000 ns

Reading operations from memory, HDD and SSD

- Read 1 MB sequentially from RAM memory...........................: 250_000 ns (250 us)
- Read 1 MB sequentially from an SSD...............................: 100_000 ns (100 us)
- Read 1 MB sequentially from an HDD (regular "mechanical" disk)...: 20_000_000 ns (20_000 us, 20 ms)

The big picture - from your machine’s microprocessor to the internet

(highest means quicker, lowest means slooooooooower)

1 ns - A processor's chip L1 cache
	10 ns  - A processor's chip L2 cache
		25 ns - Mutex lock/unlock - sync method used on threads to ensure exclusive access to resources
			100 ns - RAM Access - e.g. Redis read
			        ----- FIRST DEGRADATION MARK
					10 us - sending 1KB data over a 1Gbps network - e.g. memcached sending 1KB data over 1Gbps network
						100 us - read from SSD
							----- SECOND DEGRADATION MARK
							1 ms - Database insert - Postgres (store data, create the index and flush logs)
								10 ms - HDD disk seek
									100 ms - send a packet CA -> NL -> CA - e.g. long distance Zoom Call
										----- THIRD DEGRADATION MARK - downhill from here :(
										1 s
											10 s - an auto refresh interval on a WebUI e.g. Grafana
NOTE: The original content(s) that inspired this one can be found at:
https://blog.bytebytego.com/p/ep22-latency-numbers-you-should-know
https://dzone.com/articles/latency-numbers-everyone-should-know
All copyright and intellectual property of each one belongs to its' original author.