Bug #81902
openmgr: prometheus, pg_autoscaler and balancer rebuild full pg_dump/OSDMap dumps every loop, causing high CPU and memory at scale
0%
Description
On large clusters the mgr uses a lot of CPU and memory. Three modules rebuild
large Python objects (the full pg_dump or a full OSDMap dump) on every loop,
while holding the GIL, just to read a few fields. The same data is already
available from a smaller key or from the mgr api cache.
Per module:
prometheus
get_pool_repaired_objects() calls get('pg_dump') and walks all PGs only to
sum repaired objects per pool. 'pool_stats' gives the same data
(PGMap::dump_pool_stats()) and is much smaller. Also, three steps of
collect() are not covered by @profile_method(), so they are missing from
prometheus_collect_duration_seconds.
pg_autoscaler
Every serve loop calls OSDMap.dump() to read flags, pools and
require_osd_release. These are already in the cached 'osd_map'. The pool
list is used together with the OSDMap object, so the cache can only be used
when its epoch matches the OSDMap epoch.
balancer
Plan calls osdmap.dump() when it is created. It can use the cached 'osd_map'
instead, with the same epoch check.
| Case | Metric | Before | After | Change |
|---|---|---|---|---|
| 100 OSDs / 32K PGs | RSS mean | 1021 MB | 387 MB | -62% |
| RSS max | 1187 MB | 391 MB | -67% | |
| CPU mean | 93% | 28% | -70% | |
| CPU max | 132% | 55% | -59% | |
| prometheus collect | 9.4 s | 0.76 s | -92% | |
| 300 OSDs / 64K PGs | RSS mean | 1946 MB | 771 MB | -60% |
| RSS max | 2378 MB | 772 MB | -68% | |
| CPU mean | 138% | 61% | -55% | |
| CPU max | 180% | 121% | -33% | |
| prometheus collect | 127 s | 2.4 s | -98% |
NM Updated by Nitzan Mordechai about 1 month ago
- Backport set to umbrella, tentacle