CAWL: A Cache-aware Write Performance Model of Linux Systems

Masoud Gholami, Florian Schintke · DOI

Abstract

The performance of data-intensive applications is often dominated by their input/output (I/O) operations, but the I/O stack of modern systems is complex and heavily dependent on system-specific settings and hardware components. This complexity makes generic performance optimization challenging and costly for developers. While simulation frameworks can reduce experimental overhead, they typically handle I/O in a coarse-grained manner, leading to significant inaccuracies. We propose CAWL, a more accurate model of the write performance of Linux-based systems that accounts for various I/O methods (system calls, library calls, direct vs. indirect), the page cache, background writing, and kernel I/O throttling. Our model reduces the relative prediction error for random I/O scenarios from 67% in standard models down to 10% compared to real-world measurements.

Introduction

For data-intensive applications, I/O performance is frequently the primary bottleneck. However, the Linux I/O stack involves multiple layers of hardware and software that make performance prediction difficult. Researchers often rely on simulation frameworks like SimGrid or WRENCH to avoid the high cost of testing on every possible hardware configuration.

Existing frameworks typically use "naïve" models that estimate I/O time by simply dividing data size by the storage device's peak bandwidth. This approach ignores critical Linux kernel behaviors such as the page cache, where data is written to fast RAM first and synced to disk later, and I/O throttling, where the kernel intentionally slows down applications to prevent memory exhaustion when too much "dirty" data accumulates.

The CAWL Model

CAWL (Cache-aware Write Performance Model) is designed to model the write path across three distinct levels of I/O: Direct I/O (bypassing the cache), Synchronized I/O (using the cache but waiting for disk confirmation), and Non-synchronized I/O (writing to the cache and returning immediately).

The core of CAWL is its ability to model the "Dirty Rate"—the ratio of unsynced data to total available memory. The model tracks how the kernel transitions between different states based on this rate.

Kernel states and throttling mechanisms as a function of the dirty rate.

As shown in Figure 1, the model identifies three primary phases:

  1. Freerun: No background sync occurs, and the application writes at memory speeds.
  2. Background Sync: The kernel begins flushing data to disk in the background.
  3. Throttling: Once the dirty rate hits a specific threshold, the kernel applies a non-linear (cubic) function to slow down the process, preventing it from overwhelming the system memory.

Modeling the I/O Path and Buffering

Data often travels through two layers of buffering: a user-space buffer managed by standard libraries (like libc) and a kernel-space buffer (the page cache). CAWL explicitly models these different paths to capture the overhead of system calls and the behavior of library functions like fwrite.

Comparison of I/O paths: Direct I/O, System Call with Page Cache, and Library Call with User-space Buffering.

By accounting for these layers, CAWL can predict the performance penalties associated with "non-fitting" data—where write sizes do not align with filesystem block sizes, forcing the OS to perform expensive read-modify-write operations. To make the model practical, we developed a benchmarking tool that measures system-specific parameters, such as memory bandwidth ($bw_{mem}$), device sync bandwidth ($bw_{dev}$), and system call latency ($sc_w$), to populate the model's equations.

Key Results

CAWL was evaluated against standard SimGrid models using both high-end server hardware and consumer-grade SSD systems. The results demonstrate massive accuracy gains:

  • Random I/O: CAWL reduced relative error from 67% to 10%.
  • Sequential Writes: For large 800 GB writes, CAWL successfully predicted the exact moment kernel throttling began, a phenomenon linear models fail to capture.
  • Small Writes: For 1 KB chunks, standard models underestimated costs by 99% by ignoring system call overhead. CAWL maintained high precision by factoring in the fixed cost of each write() call.

Conclusion and Future Work

CAWL significantly improves the accuracy of I/O simulations by incorporating the complex realities of the Linux kernel. While currently focused on single-process write performance, future iterations of the model could expand to handle multi-process competition for disk resources and more granular hardware-level details, such as specific SSD controller behaviors.

Summary updated

BibTeX
@misc{gholami2023cawl,
  author = {Masoud Gholami and Florian Schintke},
  title = {{CAWL: A Cache-aware Write Performance Model of Linux Systems}},
  year = {2023},
  eprint = {2306.05701},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2306.05701},
}
Figure