Memory hierarchy concept page: CPU registers, L1/L2/L3 caches, DRAM (NUMA-local and cross-socket), NVMe SSD, SATA SSD, HDD, S3, Tape. Shows three scenarios: cache-friendly hot loop vs random pointer chase, NUMA pin vs cross-socket access, hot loop vs page fault to disk. Includes ADRs on when to optimize for cache locality and NVMe vs SATA selection.
A memory hierarchy is not one universal ladder of fixed latency numbers. It is a set of hardware, kernel and distributed-service boundaries with different units, ownership and failure modes. CPU caches and DRAM are load/store paths. The page cache is kernel-managed file data in DRAM. A block device is explicit I/O. Object storage is a remote API, not a transparent “next cache level”.
For a clock frequency f_GHz, one cycle lasts 1 / f_GHz nanoseconds. A measured latency of L_ns therefore costs approximately:
cycles = L_ns * f_GHz
At 3 GHz, one cycle is about 0.333 ns and 100 ns is about 300 cycles. Frequency can vary with power state and architecture, so this identity does not turn a benchmark from another machine into a guarantee. Measure the target CPU, access pattern, NUMA placement and concurrency. Report a distribution, not one memorized integer.
The core first needs a valid virtual-to-physical translation and permissions. A TLB miss is not automatically a page fault: hardware may complete a page-table walk and cache the translation. A page fault is an exception. It may be expected, such as lazy allocation or copy-on-write, or fatal, such as an invalid access.
A cache miss moves a cache-line request toward lower cache levels and the memory controller. DRAM latency depends on locality, contention, row state, frequency and platform. Bandwidth and latency are different: many outstanding accesses can sustain bandwidth while an individual dependency chain still waits.
The kernel page cache stores file-backed pages in memory. A minor fault can often be resolved without device I/O, for example by installing a mapping to a resident page. A major fault requires I/O and can block the faulting thread. CPU iowait accounting is not “the CPU doing the disk read”; it is scheduler/accounting context while work waits for I/O.
Writes usually dirty cached pages before writeback. write() success, page-cache visibility and durable media persistence are separate contracts. Slow writeback and reclaim can produce latency cliffs later. Watch dirty bytes, writeback time, major faults, pressure-stall information, device queue depth and tail latency.
An LSM tree buffers and sorts writes, then compacts immutable runs. It can turn random updates into more sequential I/O, including on rotating media. It does not “die on HDD” by definition. Read amplification, write amplification, compaction bandwidth, cache hit rate and the workload’s latency objective decide whether a particular design is appropriate.
An object request crosses client code, DNS/connection management, TLS, network queues, authorization and provider storage. Retries must be bounded and operation-aware. Do not compare an object-service p99 with an L1 hit as though both were interchangeable memory accesses. Cache objects locally only with an explicit freshness, eviction, integrity and authorization policy.
A core-local cache hit, with latency treated as a measurement.
A last-level-cache miss traverses the memory controller and DRAM, then refills upper caches.
A valid file mapping is absent from the page cache, so the thread blocks for device I/O and resumes after the mapping is installed.
Dirty-page writeback exposes queueing and reclaim pressure instead of pretending writes are instantly durable.
An object read is modeled as a remote authenticated service request with independent tails and retries.
Введите числа или выберите пресет