]>
git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/cephadm/autotune.py
2 from typing
import List
, Optional
, Callable
, Any
, Tuple
4 from orchestrator
._interface
import DaemonDescription
6 logger
= logging
.getLogger(__name__
)
9 class MemoryAutotuner(object):
12 'mds': 4096 * 1048576,
13 'mgr': 4096 * 1048576,
14 'mon': 1024 * 1048576,
15 'crash': 128 * 1048576,
16 'keepalived': 128 * 1048576,
17 'haproxy': 128 * 1048576,
19 default_size
= 1024 * 1048576
23 daemons
: List
[DaemonDescription
],
24 config_get
: Callable
[[str, str], Any
],
27 self
.daemons
= daemons
28 self
.config_get
= config_get
29 self
.total_mem
= total_mem
31 def tune(self
) -> Tuple
[Optional
[int], List
[str]]:
32 tuned_osds
: List
[str] = []
33 total
= self
.total_mem
34 for d
in self
.daemons
:
35 if d
.daemon_type
== 'mds':
36 total
-= self
.config_get(d
.name(), 'mds_cache_memory_limit')
38 if d
.daemon_type
!= 'osd':
41 self
.min_size_by_type
.get(d
.daemon_type
, self
.default_size
),
45 if not self
.config_get(d
.name(), 'osd_memory_target_autotune'):
46 total
-= self
.config_get(d
.name(), 'osd_memory_target')
48 tuned_osds
.append(d
.name())
53 per
= total
// len(tuned_osds
)
54 return int(per
), tuned_osds