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
- Write to parent object 1; the clone sees no change
- RADOS kept the snapshot version of parent object 1
- Write to clone object 5 (data came from the parent)
- Copy-up: the whole object 5 (4 MiB) was written from the parent snapshot into the clone
- Write to clone object 0 (data came from the parent)
- 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::copyupReading from the parent and copy-on-readsrc/librbd/io/CopyupRequest.cc :: CopyupRequestCopy-upsrc/librbd/operation/FlattenRequest.ccFlattensrc/common/options/rbd.yaml.in :: rbd_clone_copy_on_read (false), rbd_default_clone_format (auto)Clone options