PG count calculator
In the book: Chapter 7
Lab
PG count calculator
Give the OSD count and each pool's share of the data: see the classic pgcalc answer and what the pg_autoscaler would choose, pass by pass.
4800PG replicas the root may hold
200PG replicas per OSD (proposed)
14.1PG replicas per OSD (current)
| Pool | size | classic pgcalc | ideal (PG replicas) | autoscaler | would it change? |
|---|---|---|---|---|---|
| rbd | 3 | 935 → 1024 | 2304 | 1024 (even bulk) | yes: 32 → 1024 |
| cephfs.data | 6 | 312 → 256 | 2304 | 256 (even bulk) | yes: 32 → 256 |
| cephfs.meta | 3 | 42 → 32 | 96 | 32 (non-bulk) | no |
| .mgr | 3 | 8 → 8 | 0 | 32 (non-bulk) | yes: 1 → 32 |
pgcalc: pg = pow2( target × OSDs × share / size ), next power up if the nearest is > 25% below
autoscaler: root budget = mon_target_pg_per_osd × OSDs = 200 × 24 = 4800; pool = ⌊capacity_ratio × pg_left⌋ / size, rounded down or up to a power of two by a knapsack over the budget; min pg_num_min (32); changes only past the threshold (3×; 1× at 512/1024, 2× at 2048)
autoscaler: root budget = mon_target_pg_per_osd × OSDs = 200 × 24 = 4800; pool = ⌊capacity_ratio × pg_left⌋ / size, rounded down or up to a power of two by a knapsack over the budget; min pg_num_min (32); changes only past the threshold (3×; 1× at 512/1024, 2× at 2048)
The autoscaler never goes below 32 PGs (osd_pool_default_pg_num) for a pool it manages, and with bulk unset it starts small and grows with the data.
Follows:
src/pybind/mgr/pg_autoscaler/module.py :: _get_pool_status, _calculate_final_pool_pg_targetthe four passes over a root's poolsmodule.py :: PoolGroup, _find_optimal_pg_distribution, _append_resultrounding groups of pools within the budgetmodule.py :: nearest_power_of_two, get_dynamic_thresholdpower of two and the change thresholdsrc/osd/OSDMap.cc :: pool_raw_used_rateraw space per byte (size, or (k+m)/k)src/common/options/mgr.yaml.in :: mon_target_pg_per_osd (200)target PG replicas per OSDsrc/common/options/global.yaml.in :: mon_max_pg_per_osd (500), osd_pool_default_pg_num (32)the upper limit and the minimum pg_num