Linux CephFS Patch Would Curb Excessive Readahead on Random Reads
CephFS is a POSIX-compliant filesystem built on Ceph's distributed object storage. Clients can read and write file data directly.
On December 1, 2026, a Linux kernel developer submitted a patch to improve random read performance in the CephFS client.
The proposal focuses on ceph_netfs_expand_readahead(). That function expanded read ranges to match the stripe unit, the amount of data in a stripe when a file is distributed across storage.
According to the CephFS file layout documentation, both the stripe unit and the size of objects holding the data default to 4 MiB.
With this layout, if a 4 KiB random read missed the cache and triggered expansion, the client fetched 4 MiB from an object storage daemon (OSD), which stores data and handles reads and writes. That is 1,024 times the requested amount.
Readahead fetches data that may soon be needed. With sequential reads, later requests can use data fetched earlier. When a program repeatedly reads distant parts of a large file, it is less likely to use that data. Transferring unused data still consumes storage bandwidth.
Using the readahead window to classify requests
The developer explained that Linux's virtual memory subsystem sets a file's readahead window in cases such as a cache miss on a sequential read. On a cache miss for a random read, it reads the requested page without updating that window.
When initializing a readahead request, the patch checks the start of the file's window (file->f_ra.start) and its size (file->f_ra.size). It converts the request's starting offset to a page index. If the start falls outside the readahead window, it marks the request as random and skips the CephFS expansion to the stripe unit. Requests inside the window follow the existing path.
The existing optimization stays available for sequential reads. The patch changes how much data CephFS fetches based on how the file is being read.
Gains vary by access method
The developer ran comparison tests with fio on a three-OSD setup using NVMe storage and BlueStore as the OSD storage backend.
The tests used buffered reads. Sixteen jobs read sixteen 4 GiB files. The developer cleared the page cache and the OSD caches, ran tests for 60 seconds, and included the results in the December 1 submission.
After the patch, a cache miss on a 4 KiB random read fetched 4 KiB from an OSD instead of 4 MiB. The developer reported that sequential reads still fetched whole objects.
Throughput for 4 KiB random reads rose from 1,191 to 63,351 IOPS (input/output operations per second), an increase of about 53 times. The 99th-percentile response time fell from 31.9 ms to 0.45 ms, meaning about 99% of reads took no longer than the latter figure after the patch.
For 64 KiB random reads, throughput rose from 1,170 to 25,965 IOPS. Random 4 KiB reads using memory mapping (mmap), which maps a file into virtual memory, changed little, from 59,490 to 59,708 IOPS.
Sequential throughput was nearly unchanged at 1 MiB, from 4,819 to 4,814 IOPS, and at 64 KiB, from 78,380 to 79,121 IOPS. At 4 KiB it rose from 1,142,611 to 1,233,376 IOPS. In the developer's test, the patch cut the amount fetched for small random reads while largely preserving sequential performance.
In a test using another storage benchmark, IOR, 16 processes performed 4 KiB random reads across four mount points. The developer reported throughput rising from 0.0071 GiB/s to 0.218 GiB/s. A separate 4 KiB random-read test that verified checksums for each block found no errors.
Even among random reads, the access method made a big difference. Evaluating the patch's impact means considering how the application actually reads data.
Benchmark defaults can hide the problem
The developer also noted that fio sets POSIX_FADV_RANDOM by default when benchmarking random reads, so an ordinary run may not expose the problem.
Linux applications can use posix_fadvise() to tell the kernel about future access patterns. POSIX_FADV_RANDOM signals random access and disables file readahead in Linux.
fio has a setting that controls access-pattern hints. The developer set fadvise_hint=0 to disable those hints and reproduce the CephFS behavior when an application does not say that its access will be random.
A benchmarking tool can tell the operating system how it will read a file. That convenience can hide problems that occur when applications give the operating system no such hint.
KioskNews shows a cleaned-up reading view extracted from the publisher’s page — the original always lives on their site, not ours.
