Abstract
Using memory located on remote machines, or far memory, as a swap space is a promising approach to meet the increasing memory demands of modern datacenter applications. Operating systems have long relied on prefetchers to mask the increased latency of fetching pages from swap space to main memory. Unfortunately, with traditional prefetching heuristics, performance still degrades when applications use far memory. In this paper we propose a new prefetching technique for far-memory applications. We focus our efforts on memory-intensive, oblivious applications whose memory access patterns are independent of their inputs, such as matrix multiplication. For this class of applications we observe that we can perfectly prefetch pages without relying on heuristics. However, prefetching perfectly without requiring significant application modifications is challenging. In this paper we describe the design and implementation of 3PO, a system that provides pre-planned prefetching for general oblivious applications. We demonstrate that 3PO can accelerate applications, e.g., running them 30-150% faster than with Linux's prefetcher with 20% local memory. We also use 3PO to understand the fundamental software overheads of prefetching in a paging-based system, and the minimum performance penalty that they impose when we run applications under constrained local memory.
Introduction
Modern datacenters are increasingly memory-constrained, leading to the adoption of "far memory"—utilizing the RAM of remote servers as a swap space. While this expands available capacity, it introduces a massive latency gap: fetching a page from a remote machine takes microseconds, whereas local RAM takes nanoseconds. To hide this latency, Operating Systems use prefetchers to guess which pages an application will need next. However, standard heuristics often fail when local memory is severely limited (e.g., only 20% of the application's data fits locally), leading to frequent "major page faults" that stall execution.
3PO addresses this challenge for "oblivious" applications—workloads like matrix multiplication and Fourier transforms where memory access patterns are independent of the input data. By recording these patterns offline and replaying them as a "tape" at runtime, 3PO achieves nearly perfect prefetching.
The 3PO Workflow
3PO utilizes a three-step pipeline to bridge the gap between offline analysis and runtime execution.
- Tracing with Microsets: First, the application is run offline. To avoid the massive slowdown of recording every single access, 3PO's in-kernel tracer uses "microsets." The tracer allows the application to access a small working set of pages at full speed before triggering a fault to record the next set. This makes tracing orders of magnitude faster than traditional binary instrumentation tools.
- Post-Processing the "Tape": The raw trace is processed into a concise tape. 3PO simulates a local cache (using an LRU policy) to filter out pages that would likely already reside in local memory, ensuring the prefetcher does not waste network bandwidth.
- Runtime Prefetching: At runtime, the prefetcher uses the tape to stay ahead of the application's needs, pulling pages from far memory into local RAM before they are requested.
Synchronization via Key Pages
A primary challenge in pre-planned prefetching is keeping the prefetcher synchronized with the application's actual progress. 3PO solves this by identifying "key pages" on the tape.
When the application hits a key page, it triggers a page fault that acts as a low-overhead synchronization signal or "heartbeat." This signal informs the prefetcher exactly where the application is on the tape, allowing it to trigger the next batch of prefetches with high precision. This mechanism ensures alignment without requiring developers to manually modify their application code.
Key Results and Insights
The authors evaluated 3PO using seven representative oblivious workloads, including linear algebra kernels and NumPy-based FFTs. Key findings include:
- Significant Speedups: At a 20% local memory ratio, 3PO ran applications 30% to 150% faster than the default Linux prefetcher.
- Latency Resilience: 3PO’s advantage grows as network latency increases. Because it knows exactly what is needed next, it can initiate fetches much earlier than heuristic-based systems.
- Efficiency: The microset-based tracer collected traces in seconds or minutes, whereas standard tools would have taken hours and produced unmanageably large files.
Limitations and Future Work
While 3PO provides a near-optimal solution for oblivious applications, it is strictly limited to deterministic workloads. It cannot currently handle applications where memory access depends on input data, such as graph traversals. Additionally, while 3PO eliminates major page faults, applications still incur "minor faults"—the overhead of the OS mapping prefetched pages into the process's page table—which remains a fundamental bottleneck in paging-based systems. Future work may explore dynamic tapes that adapt to varying local memory availability.
Summary updated