The Comprehensive Ceph Guide
فارسیGet started

RBD clones: copy-up, copy-on-read and flatten

In the book: Chapter 3

Lab

RBD clones: copy-up, copy-on-read and flatten

Write to or read the objects of a clone and see which ones are read from the parent snapshot, when a whole 4 MiB object is copied up and what flatten does; write to the parent too and watch RADOS keep a clone of the object.

2 / 16objects owned by the clone
8 MiBdata copied up
0reads sent to the parent
1object clones on the parent

Parent (head, writable)

Parent snapshot (read-only)

p0p1p2·p4p5p6·p8p9p10·p12p13p14·

Clone

The clone's own object Read from the parent Empty (sparse) RADOS object clone
  1. Write to parent object 1; the clone sees no change
  2. RADOS kept the snapshot version of parent object 1
  3. Write to clone object 5 (data came from the parent)
  4. Copy-up: the whole object 5 (4 MiB) was written from the parent snapshot into the clone
  5. Write to clone object 0 (data came from the parent)
  6. Copy-up: the whole object 0 (4 MiB) was written from the parent snapshot into the clone

Copy-up is the hidden cost of VM clones: the first small writes to a fresh clone each read and write 4 MiB. If a clone lives long or the parent is going away, flatten it (chapter 3).

Follows:

  • src/librbd/io/ObjectRequest.cc :: ObjectReadRequest::read_parent, ObjectReadRequest::copyup Reading from the parent and copy-on-read
  • src/librbd/io/CopyupRequest.cc :: CopyupRequest Copy-up
  • src/librbd/operation/FlattenRequest.cc Flatten
  • src/common/options/rbd.yaml.in :: rbd_clone_copy_on_read (false), rbd_default_clone_format (auto) Clone options
A fixed snapshot of the simulator; the interactive version is in the web edition's lab. Interactive lab: RBD clones: copy-up, copy-on-read and flatten