How to enable RBD caching in a Red Hat Ceph Storage cluster?
Environment
- Red Hat Ceph Storage 1.2.3
- Red Hat Ceph Storage 1.3 and above
Issue
-
Does RBD support caching?
-
How can the caching in RBD enabled?
Resolution
-
RBD is unable to use the kernel page cache in linux, and so has an in-memory cache option which is disabled in Ceph Firefly and earlier.
-
To enable RBD cache, add the following under [client] section of /etc/ceph/ceph.conf, in the node using the RBD device.
rbd cache = true
-
This tunable will enable write-back cache by default, which will have writes acknowledged immediately unless there are more than 'rbd cache max dirty' unflushed bytes.
-
Some users may wish to only acknowledge writes when the data has been safely stored on the cluster; to do so the following should also be added to the ceph.conf. This will force caching to act as write-through instead of write-back.
rbd cache max dirty = 0
- If using latest version of Ceph for example hammer release then new option
rbd cache writethrough until flushcan be used with valuetruethen changing value ofrbd cache max dirtyto zero is not needed.
rbd cache writethrough until flush = true
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.