Post

Linux Kernel

The Death of the Page Cache? From mmap() to NVMe-ZNS and User-Space File Systems

This post traces the decline of the Linux page cache in modern databases and storage systems. It explores the shift from mmap() and buffered I/O to O_DIRECT, driven by SSD endurance improvements, NVMe Zoned Namespaces, and user-space filesystems. Featuring case studies of MySQL, ScyllaDB, and Redpanda, it highlights why these systems bypass the kernel cache to achieve predictable p99 latencies and tighter control over I/O.
By Codemia • August 20, 2025

8 min read

Modern storage and database systems are increasingly bypassing the traditional Linux page cache, favoring direct I/O and user-space management for performance and predictability. This post traces the evolution from classic memory-mapped files (mmap()) and buffered I/O to the rise of O_DIRECT and beyond, culminating in contemporary trends like NVMe Zoned Namespaces (ZNS) and user-space filesystems. We’ll explore why techniques that avoid the kernel page cache have become fashionable for low-latency, high-p99-predictability workloads, profiling how MySQL, ScyllaDB, and Redpanda handle I/O, and discussing the trade-offs involved.

Background: Linux Page Cache and Early I/O Strategies

In Linux (and many OSes), the page cache historically plays a crucial role in filesystem I/O. By caching file data in memory, the kernel can serve frequent reads quickly and buffer writes to optimize disk access. Early applications often relied on memory-mapped files (mmap) or standard buffered reads/writes, letting the OS page cache transparently improve performance. For instance, mapping a file with mmap() lets the kernel load pages on-demand; a page fault triggers a disk read, and the data stays cached for subsequent accesses. The downside is that a page fault causes a context switch and thread stall while the OS fetches data. Systems like Apache Cassandra that use memory-mapped SSTable files can suffer such stalls, a page miss leads to a trap into the kernel and IO wait, during which the thread is descheduled. This can add significant latency, as the thread context-switches out and back in when I/O completes.

Buffered I/O (using normal read()/write() calls without special flags) also goes through the kernel page cache. Data is copied into page cache buffers in the kernel’s address space. Reads first check if the data is already in memory (cache hit) otherwise trigger disk I/O (cache miss). Writes are stored in memory and typically written to disk later by background flush threads. This approach improves throughput by batching writes and coalescing updates, especially important on slow HDDs of the past, but it introduces unpredictability. The kernel decides when to flush dirty pages (e.g. based on timers or memory pressure), which can cause bursts of I/O at inconvenient times. These background flushes can lead to latency spikes for applications, as a sudden surge in disk writes may contend with foreground operations.

Another downside for databases is double buffering. Databases usually maintain their own caches or buffer pools for hot data (e.g. MySQL’s InnoDB buffer pool, or the Java heap in Cassandra). If the OS is also caching the same data, it wastes memory and adds an extra copy on every read/write. It became evident that for large database servers, managing caching at the application level and avoiding duplicate caching in the OS is more efficient. In fact, best practices for MySQL on modern systems include configuring InnoDB to use direct I/O so that “MySQL uses its buffer pool as disk cache, rather than using the Linux filesystem as buffer space”.

The Rise of O_DIRECT

To address these issues, Linux introduced direct I/O (O_DIRECT) in the early 2000s. When a file is opened with O_DIRECT, the kernel will bypass the page cache for reads and writes on that file. Instead, data transfers go directly between user-space buffers and the disk controller (usually via DMA). This avoids cache pollution and double buffering. Most relational databases and many NoSQL stores eventually embraced O_DIRECT for their data and WAL (write-ahead log) files. In “database land,” it’s now common to open data files with O_DIRECT and manage caching in the database itself. For example, a database will use its own buffer pool or row cache, perform unbuffered reads/writes to disk, and explicitly issue flushes (fdatasync() or fsync()) for durability. This gives the application full control over what data is cached and when it’s written to storage, rather than leaving those decisions to the kernel.

It’s worth noting that O_DIRECT comes with caveats: I/O must usually be aligned to filesystem block sizes, and using it effectively often requires an asynchronous I/O API (since bypassing the cache also bypasses the kernel’s read-ahead and write buffering). Linux provides asynchronous I/O interfaces (like io_submit/Linux AIO and the newer io_uring) to allow applications to issue concurrent direct I/O operations without blocking threads. Frameworks like Seastar (used by ScyllaDB and Redpanda) build on these to implement their own schedulers.

Linus Torvalds famously ranted about O_DIRECT, calling it a “fundamentally broken concept”, essentially arguing that if the kernel can’t do caching well, it should be fixed for everyone, not bypassed by specific apps. Despite the controversy, direct I/O proved invaluable for databases. The “worldview mismatch” here is that operating systems aim to fairly cache and optimize IO for general workloads, whereas databases often can make better-informed decisions given their access patterns. By the mid-2000s, enterprise databases (Oracle, SQL Server, MySQL, etc.) and high-performance engines were all offering direct I/O modes to avoid double-caching and unpredictable latency. For instance, Oracle on Linux used raw devices or O_DIRECT files, and MySQL’s InnoDB on Linux often runs with innodb_flush_method=O_DIRECT by default in production.

mmap() vs Direct I/O in Practice

Memory-mapped I/O (mmap) is elegant, it lets the OS page cache handle read-ahead, caching, and memory management, and one can simply access data via pointers. Some databases like LMDB (Lightning Memory-Mapped DB) exclusively use mmap for simplicity. However, as data sizes grew and SSDs became common, the cost of unpredictable page faults and kernel background activity became more apparent. Research papers have shown that mmap can underperform compared to direct I/O under certain database workloads, especially under high concurrency or large data sets. Apache Cassandra historically relied heavily on mmap for reads (OS page cache) plus an application-level key cache. In contrast, ScyllaDB (a Cassandra rewrite in C++) decided to avoid mmap and the kernel page cache altogether for reads, due to several inefficiencies:

  • Excessive Copying and Memory Waste: The OS page cache works with fixed-size blocks (usually 4 KB pages). If an application frequently reads small objects (say a 200-byte row), the OS will still load and cache whole 4 KB pages. Caching small data in large pages is memory-inefficient. ScyllaDB’s engineers noted that if you want to cache a single 300-byte row, using the page cache you’d still consume a 4096-byte page in RAM. A database-managed cache can choose a more compact representation (caching just the objects needed).
  • Poor “negative cache” behavior: If you probe for data that isn’t there (e.g., a cache miss for a key), the OS page cache has no record of “nothing here”, it might still load a page only to find the item missing. A database-aware cache could note the absence of an item without wasting space for a whole page. ScyllaDB points out that with a page cache, you’d cache entire 4K buffers even for nonexistent rows (to avoid repeated disk lookups), which is very inefficient.
  • Multiple Layers of Cache for the Same Data: Cassandra had a key cache, a row cache, and relied on the OS page cache. These layered caches mean extra overhead keeping them in sync or dealing with evictions. By contrast, ScyllaDB uses a single unified cache (storing rows in RAM in their native format) which avoids redundant caching and is simpler to manage.
  • CPU Overhead for Reads: Every read via page cache in Cassandra’s model would retrieve a whole page and then the database still has to parse that page (e.g., parse SSTable blocks). For scattered data (LSM-tree storage across many SSTables), multiple pages might need to be merged for one logical read. ScyllaDB’s approach caches the result of those merges (the parsed rows), saving CPU time on repeat reads.
  • Unpredictable Evictions: In Cassandra, compactions (which rewrite SSTables) would drop the old SSTable files, invalidating whatever pages of those files were in the OS cache. This can cause sudden cache misses for data that was recently “hot,” simply because a compaction happened. A database-driven cache can manage such events more gracefully (e.g., update cache entries to point to new SSTable locations, or use object identities that outlive file rewrite).

Given these drawbacks, many modern databases have trended towards managing caching themselves and doing I/O in user-space. This typically means using O_DIRECT for disk files and implementing background threads or async I/O to handle reads and writes, rather than letting the OS do it. As the transactional.io blog succinctly puts it: most databases now “open their WAL and data files with O_DIRECT” and maintain their own page cache and durability logic. Meanwhile, using buffered I/O with the OS cache is now mostly seen in embedded databases or single-process systems where simplicity and courtesy to the OS (sharing memory with other apps) matter more than absolute performance.

Why Bypassing the Page Cache Became Fashionable

Several converging trends in hardware and software have diminished the advantages of the kernel page cache for certain workloads:

  • High-Speed Flash and NVMe: Storage has become exponentially faster. Traditional reasoning for caching was to bridge the gap between fast CPUs and slow disks. With modern NVMe SSDs capable of hundreds of thousands of IOPS and latencies in tens of microseconds, storage is no longer so slow that it always needs an intermediary. In fact, fast SSDs can saturate the CPU or kernel. A Samsung whitepaper observed that moving from SATA SSDs to NVMe SSDs increased CPU utilization from ~5–15% up to ~30% on the same MySQL workload, because the system was doing so much more I/O per second. In other words, the bottleneck starts shifting to CPU overhead and software inefficiencies. The Linux page cache is a general-purpose layer with its own overheads (allocating pages, tracking dirty flags, kernel threads for flushing, etc.). On a very fast device, the additional copy and kernel indirection of the page cache can become a significant fraction of overall I/O time. By bypassing it, applications avoid extra copies and context switches, cutting down latency. One test noted that using direct I/O (bypassing caches) can actually make reads faster than buffered I/O on fast storage. Additionally, NVMe drives support deep parallelism (many queues, async completions) that align well with user-space IO models like io_uring or SPDK.
  • SSD Endurance and Access Patterns: Earlier-generation SSDs had limited write endurance and benefited from the OS combining small writes into larger sequential writes in cache. Now, endurance has improved, and SSD controllers themselves handle write buffering and wear-leveling robustly. Applications are more comfortable issuing writes directly, knowing the devices can absorb them (and often have their own DRAM buffers). Furthermore, many databases use a log-structured approach (append-only writes) which naturally produces sequential writes; they don’t rely on the OS to smooth out random writes as much. For example, LSM-tree databases (Cassandra, RocksDB, Scylla) write out immutable files sequentially, and streaming systems like Redpanda/Kafka also append to log files sequentially. These patterns are friendly to direct I/O.
  • Predictable Latency > Maximum Throughput: Perhaps the biggest driver is the need for consistent tail latency (e.g. p99 or p99.9 latencies). In performance-critical services, it’s not enough that the average operation is fast, the slowest 1% of operations should also meet tight SLAs. The kernel’s background activity can introduce jitter: e.g., a flush daemon kicks in and stalls writes, or memory reclamation evicts some cache unexpectedly. By bypassing the kernel cache and scheduling I/O in user-space, databases can enforce their own policies to meet latency goals. ScyllaDB explicitly did this to achieve single-digit millisecond 99th percentile latencies even at millions of ops/sec. Their internal cache and I/O scheduler give them control over exactly when reads hit disk and how writes are grouped and flushed, avoiding surprise pauses from the OS. Redpanda similarly notes that by managing disk writes themselves (using direct DMA), they can “control exactly when and how data is copied” to storage, which is crucial for predictable performance.
  • Application-Specific Optimizations: A one-size-fits-all cache like the Linux page cache cannot know an application’s access patterns as well as the application itself does. By taking over caching, databases can implement smarter policies (e.g., cache by keys or query results, pin certain critical data in memory, etc.). They can also integrate caching with other concerns like transactions or replication. For instance, a database might choose to cache post-processed objects instead of raw disk blocks (as Scylla does with rows), or to compress cached data, etc. None of that is possible with a generic OS cache. Therefore, moving caching into user-space opens the door to domain-specific innovations.
  • Avoiding Double Buffering: As mentioned, avoiding using the OS page cache eliminates duplicate copies of data in RAM. MySQL’s InnoDB, for example, has a large buffer pool caching table and index pages in memory. If the OS cache were also enabled, every page read would be cached twice (once in InnoDB, once in kernel) and every write would go through two layers (InnoDB flushes to OS, which then eventually flushes to disk). That wastes memory and CPU. By using direct I/O, InnoDB writes go straight from its buffer pool to disk, and reads come straight into its buffer pool. This reduces memory pressure and CPU overhead, and avoids swapping (since the OS can’t mistakenly swap out InnoDB’s pages thinking “the file is cached in kernel”, the only cached copy is owned by InnoDB itself). A Percona guide notes that using O_DIRECT “reduces swap pressure by preventing unnecessary double buffering”.

In summary, the kernel page cache is not dead, but in certain high-performance systems it’s increasingly sidelined. Databases “should bypass the Linux page cache” to improve efficiency, and many do just that. For latency-sensitive databases, completely avoiding the OS cache and using an integrated, application-level cache has proven to yield better performance and more consistent behavior.

Modern Storage Hardware: NVMe and Zoned Namespaces (ZNS)

While the move to direct I/O began with SATA SSDs and high-end RAID arrays, modern NVMe SSDs amplify the benefits. NVMe drives provide massive parallelism (up to 64K queues), low latency access, and high throughput, but to fully exploit them, one must minimize software overhead. Technologies like Intel’s Storage Performance Development Kit (SPDK) allow user-space applications to talk to NVMe devices directly, bypassing the kernel entirely (polling the device for completions, etc.). Even without going to that extreme, Linux’s newer IO interface io_uring drastically cuts the overhead of system calls for I/O, making it feasible to submit and complete thousands of direct I/Os per second per core with minimal CPU. io_uring can be seen as a kernel feature inspired by user-space approaches, it uses shared memory queues between user and kernel to avoid per-I/O syscalls. This is a trend: enabling user applications to drive hardware more directly.

NVMe Zoned Namespaces (ZNS)

One of the most intriguing developments is NVMe Zoned Namespaces, a feature in NVMe SSDs that exposes the drive in a more transparent way to the host. In a ZNS SSD, the logical address space is divided into zones (e.g., 256 MB each). Writes to each zone must be sequential (append-only within the zone), and the host is responsible for managing data placement and garbage collection (by resetting zones when data is no longer needed). In effect, ZNS shifts some of the flash management duties (like wear leveling and address mapping) from the device to the host software. Why do this? Because it enables better coordination between the database and the device: the host can align data placement with its access patterns, thereby minimizing write amplification and improving performance and endurance. The SSD no longer needs a large internal mapping table or to perform unpredictable garbage collection, the host (which has more compute power and higher-level knowledge) handles it.

ZNS is a game-changer for low-level storage optimization, but it requires application support. As a SNIA talk abstract put it, “to have full advantage of ZNS, host support is required (e.g., file-systems and database systems) such that application data structures [map] onto the characteristics of these zones.” In other words, the database or filesystem needs to manage data in terms of zones, doing sequential writes and resetting zones when appropriate. Traditional filesystems are not natively zone-aware, so a few approaches have emerged:

  • ZoneFS: a minimal kernel filesystem that exposes each zone as a file. The application can write to these files sequentially and issue zone reset ioctls. This still uses the kernel, but bypasses some of the complexity of a full POSIX FS.
  • User-space filesystems or engines: Many projects integrate ZNS support at the application level. A notable example is RocksDB’s ZenFS plugin. ZenFS is a user-space filesystem built into RocksDB that manages a raw zoned block device. RocksDB uses its own knowledge of SSTables (which are written sequentially and deleted on compaction) to place files into zones and recycle them. By doing so, it eliminates background garbage collection at both the filesystem and device level, leading to better throughput and more stable tail latencies. In ZenFS, when compaction frees an SSTable, it knows an entire zone can be reset immediately, the device can then erase that block of flash at a convenient time, without having to move other live data out (because ZenFS tries to group data of similar lifetime in the same zone).

The benefits can be substantial. In Western Digital’s tests, a ZNS SSD provided 57% lower average read latency under mixed read/write workloads compared to a conventional SSD (which had to do more internal work due to random writes). With ZNS, writes are orderly, and reads don’t suffer from the tail latency spikes caused by device-level garbage collection. Essentially, ZNS + host management turns a lot of the drive’s internal background work into coordinated, explicit actions by the host software.

From the perspective of the Linux page cache, ZNS strengthens the case for user-space, direct management of storage. If your application is anyway having to manage zones and decide where to place data, the kernel’s buffered I/O isn’t going to help, you’d be doing raw block management. We’re witnessing a shift where some advanced systems treat the SSD almost like an “extended memory” that they manage themselves. The kernel becomes more of a pass-through, or is removed from the data path entirely.

MySQL, for instance, can leverage ZNS through RocksDB in the latest releases. Percona Server for MySQL with the MyRocks storage engine includes built-in ZenFS support. This allows MySQL to store data on a ZNS SSD, with RocksDB/ZenFS orchestrating the writes. It’s a far cry from the days of MySQL using ext3 with buffered I/O, we now have MySQL writing to a user-space filesystem on raw flash, carefully planning which zone to write next!

Other systems embracing direct I/O and zone-aware designs include Ceph’s BlueStore (Ceph moved from using XFS with page cache to a custom object store on raw devices, yielding higher performance), and log-structured filesystems for SSDs (like F2FS, which is kernel-level but designs around flash constraints). These all operate on the philosophy of application-informed data placement, a trend that bypasses generic OS heuristics in favor of intelligence at the app/library level.

Case Studies: I/O Architecture in MySQL, ScyllaDB, and Redpanda

Let’s dive into how three different systems, a classic relational DB, a modern NoSQL DB, and a streaming log platform, handle I/O and why they (to varying degrees) kill the page cache.

MySQL (InnoDB Engine)

MySQL’s storage engine InnoDB has evolved over decades, but its approach to I/O is representative of many traditional databases. InnoDB manages a large in-memory buffer pool that caches table and index pages (typically 16 KB pages). When a query needs a page, InnoDB will check its buffer pool; if not present, it will read from disk into the buffer pool. Writes (updates) are made in-memory and marked “dirty” in the buffer pool. InnoDB flushes dirty pages to disk in the background, and uses a WAL (write-ahead log) to ensure durability (the WAL, called the redo log in MySQL, is flushed to disk at transaction commit, so that even if the buffer pool pages haven’t been written, the redo log can replay the changes after a crash).

Originally, MySQL relied on the OS to cache files (it would fsync() at critical points for safety, but otherwise use buffered I/O). However, this led to double caching: the buffer pool would hold pages and the OS page cache would also have those file blocks. It also meant the OS could decide to flush data at inopportune times. Modern MySQL deployments almost always use innodb_flush_method = O_DIRECT for InnoDB, which means InnoDB’s reads and writes to its tablespace and log files bypass the OS cache. This way, the InnoDB buffer pool is the only cache, which MySQL can size and tune as it likes. The benefit is twofold: MySQL avoids wasting memory (the buffer pool effectively is the cache, instead of cache+cache), and it has more predictable control over disk writes (only InnoDB’s own flushing threads and fsyncs will trigger writes, rather than the kernel’s flush thread). As one best-practice guide put it, after switching to O_DIRECT, MySQL “stopped using Linux’s filesystem buffer space and instead began using MySQL buffer pool as the disk cache”.

MySQL still uses the kernel’s filesystem infrastructure (ext4 or XFS for organizing data on disk), but with direct I/O the page cache layer is skipped. InnoDB issues writes that are aligned and sized to avoid fragmentation (often using 16KB or larger writes for flushing). For transaction logs, MySQL opens them with O_DIRECT and O_DSYNC on some systems, meaning each write is directly written to disk cache (or memory) and also flushed to the media (the disk’s own cache) immediately. (On Linux, O_DSYNC on a file is sometimes used for logs to avoid needing an explicit fsync if each write should be stable on disk.)

One interesting aspect is MySQL’s handling of atomicity and consistency. Because it can’t trust the filesystem to do everything, InnoDB implements features like the doublewrite buffer (to prevent torn writes of pages, it writes pages twice so that if a crash happens mid-write, the page can be recovered from the second copy). In fact, on some newer storage (e.g., NVMe devices or filesystems that guarantee atomic writes of a certain size), MySQL can skip the doublewrite buffer for better performance. MySQL also had (in 5.7) a DDL log, a special log to record metadata operations (like DROP/ALTER table) so that if a crash occurs during a DDL, it can be finished or rolled back on recovery. This DDL log (removed in 8.0 in favor of a different mechanism) is another example of the database taking on responsibilities to guarantee consistency, things a traditional OS/FS combo didn’t provide transparently. While not directly related to page cache, it shows the general direction: databases are handling more of their destiny in user-space, from caching to crash recovery.

InnoDB I/O Summary: The default (and recommended) config is direct I/O for data and index files and sometimes the log. MySQL relies on its own buffer pool for reads, and uses group commits and carefully controlled flushes for writes. Many MySQL benchmarks demonstrate that using O_DIRECT yields more stable throughput and latency by avoiding OS-side interference. However, if MySQL is running alongside other processes or if the buffer pool is undersized, there can be cases where buffered I/O (letting the OS cache) is beneficial, for example, some benchmarks on NFS or SAN storage found O_DIRECT wasn’t always fastest. It’s a tuning choice, but for dedicated database servers, bypassing the page cache is generally favored.

ScyllaDB

ScyllaDB is often cited as an example of “fully bypassing the Linux page cache” in a modern database. It’s built from the ground up to utilize the hardware efficiently via a shared-nothing, shard-per-core architecture and asynchronous I/O. Each ScyllaDB node dedicates most of the machine’s RAM to Scylla itself (90%+ of memory is reserved for Scylla, leaving just enough for the OS to function). Scylla then allocates a portion of that to its unified cache, which, unlike Cassandra’s multiple caches, holds rows of data in RAM regardless of which SSTable file or memtable they came from. This cache is kept coherent with what’s on disk and is consulted on reads. If a read misses the Scylla cache, Scylla issues an asynchronous direct read from the SSTable files.

ScyllaDB’s data files (SSTables and commit log) are stored on the filesystem (XFS is recommended) but always accessed with O_DIRECT. Internally, Scylla uses either Linux AIO (io_submit) or the newer io_uring for asynchronous operations, allowing it to have many reads in flight without blocking any thread. The design is completely non-blocking, they do not use OS threads to wait on I/O; instead a reactor per core polls completion events (much like how high-performance network apps use epoll or io_uring). This avoids context switch overhead on I/O. A read in Scylla becomes a continuation: “if not in cache, issue disk read and yield; when data is ready, resume processing.” This is handled by the Seastar framework.

Crucially, ScyllaDB implements a user-space I/O scheduler and per-shard disk bandwidth control. In a noisy environment, one query or compaction could flood the disk with requests and harm tail latencies for others. Scylla mitigates this by managing an I/O queue in its reactor, scheduling reads and writes in a fair manner (it even allows prioritization of user reads over background compactions, etc.). They keep the Linux IO scheduler set to noop on their devices, meaning the kernel will not try to reorder or merge requests (Scylla will do any needed batching). This again shows how the philosophy is to trust the database’s custom logic over the kernel’s generic algorithms. By using noop IO scheduler and O_DIRECT, Scylla’s I/Os go straight to the block device with minimal meddling. (It relies on the underlying device for actual persistence ordering; e.g., using fdatasync() when needed to flush drive caches for commit log durability, though with O_DIRECT writes and drive write cache with FUA, the flush might be implicit.)

ScyllaDB’s approach yields extremely high throughput and strong tail latency control. One Scylla node can do what many Cassandra nodes required, largely because it squeezes every drop of performance out of the hardware by eliminating overhead. In Scylla’s own tests, a workload that might cause Cassandra to experience context switches and page faults for uncached reads (each causing multi-millisecond delays) will run smoothly on Scylla with asynchronous direct reads. The Scylla cache bypasses the kernel and provides “predictable low latencies (single-digit millisecond P99)” even at millions of ops/sec.

However, Scylla’s design also assumes it fully owns the machine, it’s not very friendly to running alongside other heavy processes, since it grabs most resources and even busy-waits on each core’s event loop (to avoid slow context switches). This is a conscious trade-off for maximizing performance.

From a developer/architect perspective, ScyllaDB demonstrates the power of bypassing the page cache combined with user-space scheduling. It takes responsibility for things the kernel would traditionally do: caching, prefetching (Scylla can predict access patterns like when a sequential scan is happening and issue readahead), merging I/O requests across its scheduler, etc. The outcome is a database that can outperform Cassandra by an order of magnitude on the same hardware. The cost is complexity, essentially re-implementing a specialized “database OS” in user-space (Seastar provides a lot of that functionality like a cooperative task scheduler, I/O subsystem, memory allocator with no locking across cores, etc.). This only makes sense for systems that absolutely require extreme performance.

Redpanda

Redpanda is a streaming data platform (a drop-in replacement for Apache Kafka) written in C++ on the Seastar framework. Kafka traditionally relies on the filesystem and page cache: it uses mmap() to map log segments into memory for fast reads, and it relies on the OS to cache recently written log data until an fsync is called (Kafka’s durability is often achieved by fsync on the log after appending a batch). This design means Kafka’s performance can be influenced by the kernel’s decisions (e.g., the order of flushes) and by JVM nuances (garbage collection can pause the app, during which the OS might decide to flush caches, etc.). Kafka was built assuming disks (or SSDs) are the slower component, so kernel involvement wasn’t a big issue at the time.

Redpanda’s goal was to push performance to the limit of hardware, and in doing so they tossed aside the conventional page cache model. Redpanda uses O_DIRECT for all its disk I/O, essentially never caching logs in the OS page cache. Instead, it allocates huge chunks of memory for itself and does file I/O via DMA (Direct Memory Access) to/from those buffers. The team mentions that “100% of the machine memory (minus a small amount for OS) is allocated up front” to Redpanda’s various subsystemsr, and the log segment writers use DMA so that they “bypass the page-cache for reads and writes.” Data that’s written is kept in Redpanda’s own memory until it’s time to flush to disk (for durability). In effect, Redpanda acts like its own cache, much like a database buffer pool. For reads, Redpanda can serve recently written data directly from its in-memory log buffers or from cache, rather than relying on the OS having the data in its cache. This provides more consistent latency, because Redpanda knows exactly what is in RAM and what isn’t.

One might ask: doesn’t the OS page cache do a fine job for sequential logs? It often can, Kafka benefits from the page cache to serve consumers recent messages. But Redpanda’s choice was influenced by predictability and the desire to remove kernel overhead. By managing its own memory, Redpanda can avoid any pauses due to OS page cache eviction or VM pressure (which might otherwise interfere if the OS decided to swap or reclaim file cache at the wrong time).

Redpanda also implemented some clever optimizations to maximize throughput with direct I/O. A naive direct I/O approach (writing each message and immediately issuing fdatasync) would be slow. Instead, Redpanda employs batching: it accumulates data in large aligned buffers and writes to disk in big chunks concurrently, then calls fdatasync() occasionally. They leverage XFS’s support for sparse pre-allocated files to allow multiple large writes to be dispatched in parallel without fragmenting the file. In a blog post, Redpanda’s team noted a 10x throughput improvement by doing batched, concurrent writes followed by a single fdatasync, compared to using a file opened with O_DIRECT|O_DSYNC (which would flush to disk on every write). In other words, they don’t always combine O_DIRECT with O_DSYNC; they might write with O_DIRECT (bypassing cache) but only explicitly flush once per batch. This achieves a kind of group commit similar to databases, but at the application level.

Moreover, Redpanda tackles other sources of latency: it tunes interrupt handling and CPU isolation so that device interrupts (from NVMe or NIC) are spread across cores to avoid stalls.The entire ethos is building a vertically integrated, mechanically sympathetic system.

The result is impressive raw performance. Redpanda has published benchmarks showing much lower latencies than Kafka and better throughput, especially at high percentiles, largely thanks to these architectural choices. It is able to operate closer to the hardware limits, “within 10% of the physical limits” of the device in some cases. This is the “speed of hardware” claim: by removing layers (JVM, page cache) and using efficient C++ with kernel bypass techniques, Redpanda can utilize fast NVMe drives and high core counts more effectively.

One interesting note is that Redpanda uses the same kind of reactor pattern as Scylla (Seastar framework). This means it, too, schedules I/O in user space. Redpanda even provides an “auto-tuner” (rpk – Redpanda Keeper) that will set the Linux kernel settings (like scheduler = noop, swappiness, CPU governor, etc.) appropriately for you. This underlines that when you bypass a lot of kernel functionality, you often need to manually tune what remains in the kernel.

Table: I/O Strategy Comparison

To summarize the differences, the table below compares the I/O models of MySQL, ScyllaDB, and Redpanda:

SystemKernel Page Cache UsageI/O Mode & APIsUser-Space CachingNotable Features
MySQL InnoDBOptional (typically disabled with O_DIRECT for data files). Still uses OS filesystem (ext4/XFS).Mix of synchronous writes (with group commit) and buffered reads, or direct I/O if configured. Uses fsync() for WAL and flushes. Modern MySQL uses O_DIRECT for most I/O on InnoDB (and O_DSYNC for logs) to bypass OS cache.Yes – InnoDB buffer pool caches pages (typical size GBs). Also separate change buffer, adaptive hash index in memory.Doublewrite buffer for atomic page writes. Supports atomic writes on special FS to skip doublewrite. Has internal recovery logs (e.g., DDL log) for consistency. Benefit: avoids double caching and uses MySQL-controlled flush policy. Drawback: still uses OS threads for I/O, and single flush thread can bottleneck on fast storage (mitigated by multiple buffer pool instances, etc.).
ScyllaDBNone – completely bypasses kernel cache (opens all data/log files with O_DIRECT). The OS is left only with minimal memory for OS itself.Fully asynchronous direct I/O (uses Linux AIO or io_uring). No blocking syscalls on hot path. Uses its own I/O scheduler in user-space, kernel I/O scheduler set to noop.Yes – Unified memory cache for rows. Also uses allocation strategies (shard-per-core memory). Essentially all data cached in Scylla’s memory, none in kernel.Shard-per-core architecture (each core handles a partition of data and has its own event loop). Custom scheduler for I/O and CPU. Achieves very high throughput and low tail latency. Requires pinning huge memory and dedicating cores. No context-switch overhead on cache misses (continuations used instead).
RedpandaNone – bypasses page cache via direct DMA reads/writes. Uses XFS but with direct I/O on files.Asynchronous direct I/O via Seastar (like Scylla). Batches writes in large aligned chunks and uses fdatasync() at batch boundaries. Also uses sendfile()/zero-copy for networking where possible.Limited – Redpanda keeps recent log data in memory buffers until flushed (for durability). It doesn’t cache old log segments (relying on consumers sequential access). Instead of page cache, it relies on sequential disk access for older data. It does, however, use memory for read-ahead and uses its own allocator to manage memory across subsystems.Log-structured storage (commit log segments). Auto-tuning of kernel parameters. Achieves ~10x throughput vs Kafka on same hardware in some tests. Highly optimized for sequential writes and batched reads. Tailored for NVMe (e.g., uses multiple submission queues). Predictable latency even under load due to tight control of I/O.

(Table legend: “Kernel Page Cache Usage” refers to whether the system uses Linux’s buffered I/O cache. “I/O Mode & APIs” highlights how the system issues disk operations. “User-Space Caching” describes any caching the application itself does in RAM. Notable features mention unique aspects related to I/O.)

Each approach has pros and cons. MySQL’s design is conservative, relying on decades of refinement in the kernel for scheduling writes (unless O_DIRECT is used) and simplicity of using the OS for reads/writes but still benefiting from an internal cache. Scylla and Redpanda represent an aggressive user-space optimization philosophy: they minimize kernel involvement to deliver stable low latencies and high throughput, at the cost of essentially reimplementing caching, prefetch, and scheduling in the application.

Trade-Offs: Is the Page Cache Really Dead?

The page cache isn’t universally dead – but in these specialized systems, it has certainly been demoted. There are important trade-offs to consider:

  • Development Complexity: Bypassing the kernel cache means the application takes on the responsibility of caching, prefetching, write coalescing, and recovery from partial writes. This is non-trivial logic that the OS normally provides. Bugs in these areas can be disastrous (data loss or corruption). It’s a lot easier to rely on the battle-tested filesystem and kernel pager when ultimate performance isn’t required. Only very mature projects (often with C++ low-level coding) attempt this, and it requires deep expertise in OS and hardware behavior.
  • Memory Management: When many applications run on one system, the kernel’s unified page cache can dynamically allocate memory to the apps that need it (for file caching) and free it when others need more RAM. If every application instead hoards memory for its own cache (and uses direct I/O), you lose that dynamic sharing. In a multi-tenant environment (e.g., cloud VMs running various apps), it might be better to let the OS decide cache allocation. The page cache will automatically use free memory for caching and will give it up under memory pressure. In contrast, an app like Scylla or Redpanda grabs, say, 60–70% of RAM for itself and won’t easily relinquish it. Thus, the “all in user-space” approach is best when you have a dedicated appliance or service.
  • Workload Characteristics: If the workload fits in memory or has strong locality, the page cache can actually do a great job with minimal tuning. Moreover, the kernel developers have continuously improved things like readahead algorithms, NUMA awareness, etc., which an application author would need to handle if bypassing it. For example, RocksDB often by default relies on OS cache for uncompressed data caching, while it manages a cache of compressed blocks itself. This split approach can work well: OS handles the low-level caching of file blocks, and RocksDB handles higher-level caching (and it provides options to use direct I/O for those who want it). There are still debates; as one comment noted, sometimes using mmap/page cache can be as fast or faster for reads, but the complexity comes with writes and managing eviction.
  • Edge Cases and Performance Traps: The kernel’s buffered I/O has some optimizations that are non-trivial to reproduce. For instance, the kernel can merge adjacent small writes in the cache before writing to disk, reducing random write load. If an application issues lots of tiny direct writes, it might actually get lower throughput on devices that prefer big sequential writes (unless the app itself merges them). Similarly, the kernel’s I/O scheduler (in non-noop mode) can reorder requests to minimize seek time, something an app using async direct I/O might skip. In practice on SSDs and with good app design, these are less of an issue (SSDs don’t have seek costs like HDDs did, and databases batch their I/O anyway), but it’s something to consider.
  • Stability and Predictability: By bypassing the page cache, you eliminate one big source of unpredictability (the kernel flush/page-reclaim behavior). But you might introduce others if not careful, e.g. if your user-space I/O scheduler isn’t as fair, you could starve certain operations. Or if you don’t implement throttling, you could overwhelm the device with I/O. The kernel’s mechanisms (like cgroups for IO throttling, or global dirty page limits) won’t help you if you bypass them. Systems like Scylla had to implement their own admission control to avoid saturating disks with too many requests and increasing latency. They even integrate scheduling of compactions vs reads at the application level. So, it’s a more tightly coupled system, which is great when tuned, but can misbehave if any assumptions are wrong.
  • Hardware Evolution: As hardware evolves, operating systems eventually catch up. For example, persistent memory (Intel Optane DC PMEM) led to Linux adding DAX (Direct Access) so that files on PMEM can be accessed with loads/stores (bypassing page cache and normal block layer). NVMe and fast networks led to io_uring and other improvements. It’s possible that the kernel will incorporate more zone-aware logic or more user-space hints (like open_zone() flags or so). The page cache itself might get smarter for SSDs (there’s research on adaptive caching or leveraging hints like fadvise for sequential access). In short, today’s advantage of doing things in user-space might narrow in the future if kernels provide equivalent performance with less effort. On the other hand, by the time that happens, user-space systems will likely be pushing into new territory (like coordinating caching across distributed systems, or integrating with storage-class memory in ways OS is not yet doing).

Bottom line: The Linux page cache isn’t going away, for general computing, it’s still a huge boon. But in high-end storage architectures, its role is diminished. We’ve effectively pulled the intelligence up the stack: databases and engines are keen to manage their own I/O to wring out every ounce of performance and consistency. As SSDs and new tech like NVMe ZNS remove previous device-side constraints (and add new capabilities), applications are seizing the opportunity to control data placement, caching, and access patterns very tightly. This indeed feels like the “death” of the page cache in those contexts, since the OS is mostly doing pass-through I/O.

However, this comes with the responsibility of doing it right. Not every application needs to or should take this path. For many, the kernel’s default caching and I/O subsystem work perfectly fine and provide a good balance of performance and simplicity. The trend is clear though: in systems where performance is a competitive advantage (databases, high-frequency trading systems, messaging brokers, etc.), we see a strong preference for user-space, kernel-bypassing designs. The kernel is becoming more of a set of basic I/O plumbing and isolation (ensuring processes don’t step on each other) rather than the mastermind of storage. As an engineer or architect, it’s important to recognize when your workload might benefit from this approach. If you’re after ultra-low tail latencies and you control your deployment environment, bypassing the page cache and even the kernel’s schedulers can unlock new levels of performance, as demonstrated by MySQL’s optimized configurations, ScyllaDB’s design, Redpanda’s record-breaking benchmarks, and the realm of ZNS-optimized data stores.

In conclusion, the “death of the page cache” is not a literal one-size-fits-all obituary, but a sign of the times: systems are becoming vertically integrated. By understanding your workload deeply and leveraging modern hardware features directly, you can often do better than a generic OS. The page cache was a brilliant solution for the era of slow disks and mixed workloads, but in today’s world of fast NVMe, large RAM, and specialized servers, it often pays to take control. The kernel provides the tools (like O_DIRECT, io_uring, hugepages, and zone interfaces); it’s up to us to use them wisely, or let the kernel handle things when that wisdom is not worth the complexity. The future likely holds even more user-space innovation in storage (think user-space network storage protocols, or ML-assisted caching), with the kernel focusing on safe arbitration and basic services. In that sense, for certain classes of applications, the traditional page cache-centric I/O path is indeed on its way out, and a new breed of application-managed I/O is taking over, from mmap() to O_DIRECT to ZNS and beyond.

Keep learning on Codemia