Ceph libRBD cache control

1/13/2020

So Ceph has a user-space page cache implementation in librbd. Does it allow users to mention how much page cache to allocate to each pod? If yes, can we dynamically change the allocations?

-- Pranav Bhandari
ceph
kubernetes

1 Answer

1/13/2020

There is no reference to page cache allocation at the POD level according to documentation and issues in the project github.

Ceph supports write-back caching for RBD. To enable it, add rbd cache = true to the [client] section of your ceph.conf file. By default librbd does not perform any caching. Writes and reads go directly to the storage cluster, and writes return only when the data is on disk on all replicas. With caching enabled, writes return immediately, unless there are more than rbd cache max dirty unflushed bytes. In this case, the write triggers writeback and blocks until enough bytes are flushed.

This are the currently supported RDB Cache parameters and they must be inserted in the client section of your ceph.conf file:

rbd cache = The RBD cache size in bytes. | Type: Boolean, Required: No, Default: false

rbd cache size = Enable caching for RADOS Block Device (RBD). | Type: 64-bit Integer, Required: No, Default: 32 MiB

rbd cache max dirty = The dirty limit in bytes at which the cache triggers write-back. | If 0, uses write-through caching. Type: 64-bit Integer, Required: No, Constraint: Must be less than rbd cache size, Default: 24 MiB

rbd cache target dirty = The dirty target before the cache begins writing data to the data storage. Does not block writes to the cache. | Type: 64-bit Integer, Required: No, Constraint: Must be less than rbd cache max dirty, Default: 16 MiB

rbd cache max dirty age = The number of seconds dirty data is in the cache before writeback starts. | Type: Float, Required: No, Default: 1.0 rbd cache max dirty age

rbd cache writethrough until flush = Start out in write-through mode, and switch to write-back after the first flush request is received. Enabling this is a conservative but safe setting in case VMs running on rbd are too old to send flushes, like the virtio driver in Linux before 2.6.32. | Type: Boolean, Required: No, Default: false

-- willrof
Source: StackOverflow