Mechanical Sympathy for Elephants: Reducing I/O and Memory Stalls
summary
Patch adds a recovery prefetcher that scans WAL records, issues kernel read hints and keeps a second read head ahead of replay; with max_recovery_prefetch_distance and maintenance_io_concurrency set, replicas jump from ~250 to ~1,143 reads/sec (cranked to 50 reaches primary throughput) and avoid replay stalls unless full_page_writes forces extra reads. A separate patch changes hash join build/probe to batch inserts, buffer tuples and issue explicit prefetches, cutting LLC misses (28M→2.4M) and dropping runtime (5.8s→2.7s) in tests.
AI-written summary · about
chapters (14)
- 0:00Start
- 1:22Talk structure
- 1:38Three kinds of predictions about future access
- 5:53More opportunities to predict I/O
- 6:41Inspiration: pg_prefaulter Presented by Sean Chittenden, PGCon 2018
- 7:39"Physiological" logging Logical changes within pages, but physical references to pages
- 11:28User interface As of most recent patch - details likely to change!
- 13:09pgbench time Scale 2000, 16GB RAM, 5000 IOPS cloud storage, -c16 - 16
- 16:06Problems
- 19:38Prefetching hash joins
- 20:27Hash table vs cache hierarchy
- 21:24Software prefetching
- 22:59Hash table vs L3 cache
- 24:57Algorithm changes
