CRUSH playground
In the book: Chapter 8, Chapter 28
Lab
CRUSH playground
Build a root, hosts and OSDs, choose a rule, and watch straw2 place every PG; mark an OSD out or down or change a weight and see which PGs move.
64 × 3PGs × replicas
9.9%data moved by the last change
19PGs whose up set changed
0PGs with fewer copies than size
0empty slots (NONE)
Last change: osd.4 marked out. Moved shards are highlighted in the list.
$ ceph osd map pool1 rbd_data.10226b8b4567.0000000000000000ceph_str_hash_rjenkins → 0x87bd7b9a · ceph_stable_mod(·, 64, 63) → pg 1.1a · pps 0x8d2145b9 · up [4,2,8] p4
PG → up set (64 PGs; primary underlined)
- 1.0[0,6,5]
- 1.1[7,4,0]
- 1.2[4,7,0]
- 1.3[4,8,2]
- 1.4[1,8,5]
- 1.5[4,8,0]
- 1.6[6,4,2]
- 1.7[1,7,5]
- 1.8[6,0,4]
- 1.9[8,4,2]
- 1.a[1,5,7]
- 1.b[1,8,5]
- 1.c[6,5,2]
- 1.d[7,4,2]
- 1.e[1,8,4]
- 1.f[6,2,4]
- 1.10[5,2,8]
- 1.11[4,8,0]
- 1.12[0,6,5]
- 1.13[4,6,1]
- 1.14[5,8,1]
- 1.15[8,5,2]
- 1.16[5,0,6]
- 1.17[8,0,5]
- 1.18[6,2,4]
- 1.19[6,0,4]
- 1.1a[4,2,8]
- 1.1b[8,1,4]
- 1.1c[8,4,1]
- 1.1d[6,0,5]
- 1.1e[8,4,0]
- 1.1f[8,5,2]
- 1.20[2,6,5]
- 1.21[6,0,4]
- 1.22[2,4,6]
- 1.23[0,5,7]
- 1.24[0,4,6]
- 1.25[8,5,0]
- 1.26[1,4,6]
- 1.27[1,7,5]
- 1.28[5,7,0]
- 1.29[8,2,4]
- 1.2a[5,2,6]
- 1.2b[8,0,4]
- 1.2c[7,0,4]
- 1.2d[2,7,4]
- 1.2e[6,2,4]
- 1.2f[0,4,6]
- 1.30[6,5,0]
- 1.31[0,6,4]
- 1.32[0,6,4]
- 1.33[4,6,2]
- 1.34[8,0,5]
- 1.35[8,2,4]
- 1.36[7,0,4]
- 1.37[4,7,0]
- 1.38[6,4,2]
- 1.39[0,5,6]
- 1.3a[0,8,4]
- 1.3b[4,1,6]
- 1.3c[5,6,0]
- 1.3d[5,8,2]
- 1.3e[5,1,7]
- 1.3f[7,4,1]
Follows:
src/crush/mapper.c :: crush_do_ruleruns the rule steps (take, chooseleaf, emit)src/crush/mapper.c :: crush_choose_firstn, crush_choose_indepthe replicated (firstn) and EC (indep) choice loops with retriessrc/crush/mapper.c :: bucket_straw2_choose, generate_exponential_distribution, crush_lnstraw2: the largest ln(hash)/weight winssrc/crush/mapper.c :: is_outthe reweight check that rejects an out OSDsrc/crush/hash.c :: crush_hash32_rjenkins1_2, _3the Jenkins hash that CRUSH usessrc/osd/osd_types.cc :: pg_pool_t::raw_pg_to_pps, hash_keythe PG's seed that enters CRUSHsrc/include/rados.h :: ceph_stable_modobject hash to PG while pg_num is not a power of twosrc/common/ceph_hash.cc :: ceph_str_hash_rjenkinsthe object-name hashsrc/osd/OSDMap.cc :: _pg_to_raw_osds, _raw_to_up_osdsraw set to up set (down OSDs are dropped or become NONE)src/crush/CrushWrapper.cc :: add_simple_rule_at, insert_item; CrushWrapper.h :: set_tunables_jewelthe rule ceph osd pool create makes and the jewel tunables