Understanding and Bypassing the 60-Year-Old Design Flaw in RAM with Tailslayer

LaurieWired

Summary:
  • The video introduces a 60-year-old design flaw in RAM (DRAM) where it periodically "goes blind" for approximately 400 nanoseconds to refresh its cells, leading to significant latency spikes (tRFC lockout).
  • A benchmarking program called Tailslayer was developed to measure and demonstrate these refresh stalls, showing consistent 7.82 microsecond intervals between them.
  • The initial attempt to predict and avoid these stalls by scheduling reads around them proved ineffective due to complex factors like opportunistic refresh scheduling by the memory controller and OS interference.
  • The speaker, LaurieWired, pivoted to a "hedged read" strategy, inspired by Google's "The Tail at Scale" paper, which involves duplicating memory requests across different memory channels to increase the probability of a fast read.
  • This strategy, while successful in theory, faces challenges with modern CPUs' out-of-order execution and reorder buffers, which can negate the benefits of parallel reads by forcing in-order commitment.
  • Multi-core processors circumvent the reorder buffer issue by having separate reorder buffers for each core, enabling truly independent hedged reads.
  • A significant hurdle is the operating system's virtual memory abstraction and undocumented channel scrambling performed by memory controllers (Intel, AMD, ARM), which obfuscates physical memory addresses and data distribution.
  • To overcome this, LaurieWired reverse-engineered the channel scrambling using hardware performance counters (on AMD/Intel) and later a "latency as signal" method (on AWS Graviton, a black box), mapping how different address bits affect channel placement.
  • The results demonstrate substantial reductions in tail latency (p99.99 and beyond) across various platforms, with up to 15x improvement on Intel Xeon, validating the effectiveness of the Tailslayer methodology.

DRAM Refresh Stalls on AMD EPYC 7713 (Milan) DDR4
DRAM Refresh Stalls on AMD EPYC 7713 (Milan) DDR4 [ 00:04:30 ]

The 60-Year-Old Design Flaw in RAM [00:00]

Hedged Reads Strategy [08:02]

Addressing Physical Memory and Channel Scrambling [20:19]

Performance Results and Real-World Application [38:46]