﻿# The first guest flush can change librbd cache behavior

A VM's initial write-through behavior can hide a later write-back transition. Verify the librbd cache policy and guest flush path before accepting checkpoint durability.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/ceph-rbd-cache-first-flush-transition/
Language: en

## Boot-time behavior can mislead the test

A virtual machine writes a checkpoint soon after boot and appears to wait for remote storage. A later write returns much sooner. This change can reflect the librbd cache's transition after its first flush rather than a faster network or a warmer storage device.

The [RBD configuration reference](https://docs.ceph.com/en/tentacle/rbd/rbd-config-ref/) documents a conservative write-through-until-flush behavior. A benchmark that spans this transition mixes different acknowledgement paths unless it records the effective cache configuration and the point at which the guest sends a flush.

## Identify the client implementation

Establish whether the volume is accessed through userspace librbd or the kernel block-device path. The documented librbd cache is an in-memory client cache, with a separate cache for each image. Do not transfer its configuration behavior to another client implementation merely because both expose an RBD volume.

Record cache enablement, policy and dirty limits. Write-around and write-back differ in whether reads are served from cache, while dirty limits can make writes wait. A fast acknowledgement by itself does not identify which policy or limiting condition was active.

## Trace the durability request

Follow the application's synchronization request through the guest filesystem and virtual block stack to the RBD client. The first observed flush shows that this path can emit a request; it does not prove that every subsequent checkpoint correctly orders its components or handles synchronization errors.

Keep the backing [pool configuration](https://docs.ceph.com/en/tentacle/rados/operations/pools/) attached to the evidence. Flushing client dirty data and meeting the pool's protection policy are related stages, but neither establishes that the application's saved state is internally consistent.

## Separate warm-up from accepted work

In a controlled environment, mark the first flush boundary explicitly and distinguish pre-transition writes from later operations. Use a disposable image and a known checkpoint fixture. Compare the same cache policy and synchronization sequence rather than allowing boot-time history to determine the result accidentally.

Do not disable the conservative behavior solely to improve an early benchmark. That changes the assumption about guests issuing flushes. Any revised policy requires evidence for the actual guest stack, including the application's treatment of failed writes and failed synchronization.

## Evidence for a usable checkpoint

Acceptance combines the intended effective policy, observed synchronization propagation, successful readback and application restoration. If testing interruption behavior, isolate it from production data and record exactly which acknowledged checkpoint is expected to survive. A clean shutdown alone does not exercise loss of an unflushed client cache.

The [file and directory synchronization guide](/journal/guide-storage-fsync-directory/) explains publication ordering at the filesystem layer. The [snapshot guide](/journal/guide-storage-filesystem-snapshot/) explains why a visible image is not automatically an application-consistent checkpoint.

## Coherence is a separate contract

The client-local cache does not provide coherence when multiple clients access the same image. Observing correct flushes from one VM does not authorize a shared-writer arrangement. Validate the supported client and filesystem combination independently. This article reports no durability experiment; it defines the evidence needed to distinguish a cache-mode transition from genuine storage acceleration and a successful flush from a recoverable application state.
