Repository navigation
Conversation
4 of 14 tasks
Config Diff Tool Output! changed: osd_client_message_size_cap: old: (osd.yaml.in)
! changed: osd_client_message_size_cap: new: ['runtime'] (osd.yaml.in)
! changed: osd_client_message_size_cap: old: The maximum total memory devoted to in-flight client request messages. When the in-flight total exceeds this value, the OSD stops reading new client data from the network until memory is freed. (osd.yaml.in)
! changed: osd_client_message_size_cap: new: The maximum total memory devoted to in-flight client request messages. When the in-flight total exceeds this value, the OSD stops reading new client data from the network until memory is freed. Below an osd_memory_target of 4 GiB the default is scaled down by osd_memory_target / 4 GiB; a value set explicitly is used as is. (osd.yaml.in)
! changed: osd_target_pg_log_entries_per_osd: old: (global.yaml.in)
! changed: osd_target_pg_log_entries_per_osd: new: ['runtime'] (global.yaml.in)
! changed: osd_pg_log_dups_tracked: old: (global.yaml.in)
! changed: osd_pg_log_dups_tracked: new: ['runtime'] (global.yaml.in)
! changed: osd_memory_target: old: When TCMalloc is available and cache autotuning is enabled, the OSD tries to keep this many bytes mapped in memory. The value must be at least osd_memory_base + osd_memory_cache_min. Note that this may not exactly match the process's RSS: although the total heap memory mapped is usually close to this target, the kernel is not guaranteed to reclaim unmapped memory. Some kernels have been observed to let the OSD's RSS exceed the mapped memory by up to 20%, though kernels may reclaim more aggressively under memory pressure. Your mileage may vary. (global.yaml.in)
! changed: osd_memory_target: new: When TCMalloc is available and cache autotuning is enabled, the OSD tries to keep this many bytes mapped in memory. The value must be at least osd_memory_base + osd_memory_cache_min. Note that this may not exactly match the process's RSS: although the total heap memory mapped is usually close to this target, the kernel is not guaranteed to reclaim unmapped memory. Some kernels have been observed to let the OSD's RSS exceed the mapped memory by up to 20%, though kernels may reclaim more aggressively under memory pressure. Your mileage may vary. Below 4 GiB, some limits on memory that the autotuner cannot shrink are scaled down while they are at their defaults: osd_client_message_size_cap by osd_memory_target / 4 GiB, and osd_target_pg_log_entries_per_osd, osd_pg_log_dups_tracked and (when the OSD starts) the RocksDB max_total_wal_size by the square root of that ratio. A value set explicitly is used as is. (global.yaml.in)
! changed: osd_memory_target: old: When TCMalloc is available and cache autotuning is enabled, the OSD tries to keep this many bytes mapped in memory. The value must be at least ``osd_memory_base`` + ``osd_memory_cache_min``. Note that this may not exactly match the process's RSS: although the total heap memory mapped is usually close to this target, the kernel is not guaranteed to reclaim unmapped memory. Some kernels have been observed to let the OSD's RSS exceed the mapped memory by up to 20%, though kernels may reclaim more aggressively under memory pressure. Your mileage may vary. (global.yaml.in)
! changed: osd_memory_target: new: When TCMalloc is available and cache autotuning is enabled, the OSD tries to keep this many bytes mapped in memory. The value must be at least ``osd_memory_base`` + ``osd_memory_cache_min``. Note that this may not exactly match the process's RSS: although the total heap memory mapped is usually close to this target, the kernel is not guaranteed to reclaim unmapped memory. Some kernels have been observed to let the OSD's RSS exceed the mapped memory by up to 20%, though kernels may reclaim more aggressively under memory pressure. Your mileage may vary. Below 4 GiB, some limits on memory that the autotuner cannot shrink are scaled down while they are at their defaults: ``osd_client_message_size_cap`` by ``osd_memory_target`` / 4 GiB, and ``osd_target_pg_log_entries_per_osd``, ``osd_pg_log_dups_tracked`` and (when the OSD starts) the RocksDB ``max_total_wal_size`` by the square root of that ratio. A value set explicitly is used as is. (global.yaml.in)
! changed: osd_memory_target: old: ['bluestore_cache_autotune', 'osd_memory_cache_min', 'osd_memory_base', 'osd_memory_target_autotune'] (global.yaml.in)
! changed: osd_memory_target: new: ['bluestore_cache_autotune', 'osd_memory_cache_min', 'osd_memory_base', 'osd_memory_target_autotune', 'osd_client_message_size_cap', 'osd_target_pg_log_entries_per_osd', 'osd_pg_log_dups_tracked', 'bluestore_rocksdb_options'] (global.yaml.in)
The above configuration changes are found in the PR. Please update the relevant release documentation if necessary. |
Contributor
Author
|
/config check ok |
The cache autotuner keeps an OSD near osd_memory_target by shrinking its caches, but the PG log is bounded by limits sized for the default 4 GiB target (osd_target_pg_log_entries_per_osd=300000, osd_pg_log_dups_tracked=3000 per PG), and nothing shrinks it. At a 1 GiB target with 256 PGs per OSD and sustained 4K writes, the PG log alone took 216 to 252 MiB per OSD. Below the default target, lower the defaults of both options by the square root of osd_memory_target / 4 GiB (150000 and 1500 at 1 GiB). The OSD does it with set_val_default() right after global_init() and again whenever osd_memory_target changes. A default set this way yields to a value set at any higher level, so an explicit value is used as is, even one equal to the default, and setting one is how to opt out. set_val_default() updates the config fields in place, so the readers are unchanged, and the scaled values show in `ceph config show`. The two options are flagged runtime, which they already are in practice, so that the OSD may lower them after startup. At or above 4 GiB nothing changes. The square root, not the ratio itself, because a shorter log turns the log recovery of a restarted OSD into backfill. Six OSDs at a 1 GiB target, 256 PGs each, 4K random writes at about 9 per second and PG, one OSD killed and restarted after N seconds (WAL at 512 MiB and message cap at 125 MiB in all three); PGs backfilled / PGs recovered from the log only, of about 230 on that OSD: down ratio (75000/750) square root (150000/1500) default 10 s 192 / 11 118 / 108 6 / 220 30 s 188 / 4 116 / 108 6 / 221 60 s 217 / 2 201 / 14 79 / 150 120 s 229 / 0 229 / 3 195 / 25 300 s 230 / 0 244 / 0 231 / 0 PG log per OSD 58-68 MiB 113-131 MiB 216-252 MiB peak RSS per OSD 845 MiB 964 MiB 1141 MiB So at this write rate a short restart still backfills about half of the PGs, where the default log backfills almost none; that is the price of the smaller log, and the release note says so. On its own this does not bring a 1 GiB OSD under its target (1022 to 1040 MiB peak in a shorter mixed workload, against 1052 to 1062 MiB); the WAL has to shrink as well, which the next commits do. Document it in the BlueStore configuration reference and in PendingReleaseNotes. Co-authored-by: Ming Lei <[email protected]> Assisted-by: Claude-Code-v2.1.331:claude-fable-5-2 Signed-off-by: Dan van der Ster <[email protected]>
Add unittest_osd_memory_target_defaults: the OSD lowers the two defaults at a 1 GiB target, restores them when the target goes back up, leaves them alone at the default target, and keeps an explicitly set value, including one equal to the default. Co-authored-by: Ming Lei <[email protected]> Assisted-by: Claude-Code-v2.1.331:claude-fable-5-2 Signed-off-by: Dan van der Ster <[email protected]>
Besides the PG log, two more consumers are bounded by limits sized for
the default 4 GiB target that the cache autotuner cannot shrink: the
RocksDB WAL, and with it the memtables (max_total_wal_size=1 GiB in
bluestore_rocksdb_options), and the client message bytes in flight
(osd_client_message_size_cap=500 MiB).
Below the default target, lower their defaults as well, while they are
at their defaults: the message cap by osd_memory_target / 4 GiB, and
the WAL by the square root of that ratio (125 MiB and 512 MiB at
1 GiB). The WAL is rewritten inside the default
bluestore_rocksdb_options string at startup only, before BlueStore
mounts; a bluestore_rocksdb_options set for any reason is used as is.
handle_conf_change() resets the client throttle when the target
changes. osd_client_message_size_cap is flagged runtime, which it
already is in practice.
Six OSDs at a 1 GiB target, 256 PGs each, rbd pool at size 3, a
librbd load generator with 16 threads. With no option set, against
today's limits set explicitly, two runs each: peak RSS per OSD 795
and 806 MiB against 1062 and 1052 MiB; 4K random writes 4417 and 4648
against 4526 and 4464 IOPS; 4K random reads 27.7k IOPS in both; 4M
writes with 64 in flight 1107 and 1077 against 1156 and 1131 MiB/s.
How the two sizes were chosen (an earlier build, PG log limits at
75000 / 750, two runs per cell, mean):
WAL / cap 4K randwrite p99.9 4K randread 4M write peak RSS
IOPS IOPS 64 in fl. per OSD
1 GiB / 500 MiB 4548 9.2 ms 27652 1111 MiB/s 995 MiB
1 GiB / 125 MiB 4607 9.0 ms 27691 1052 MiB/s 1008 MiB
512 MiB / 500 MiB 4727 9.1 ms 27638 1051 MiB/s 803 MiB
512 MiB / 125 MiB 4644 10.4 ms 27834 1082 MiB/s 806 MiB
256 MiB / 500 MiB 4631 14.6 ms 27742 1013 MiB/s 655 MiB
256 MiB / 125 MiB 4710 11.0 ms 27893 1067 MiB/s 613 MiB
Throughput does not depend on either. The WAL sets the memory, about
200 MiB per halving, and at a quarter (256 MiB) the 4K write p99.9
goes up, because the memtables flush more often: hence the square
root. The message cap showed no cost in these runs and no saving
either: one client with at most 1 GiB in flight does not reach it. It
bounds what many clients sending large writes can pin.
Co-authored-by: Ming Lei <[email protected]>
Assisted-by: Claude-Code-v2.1.331:claude-fable-5-2
Signed-off-by: Dan van der Ster <[email protected]>
Extend unittest_osd_memory_target_defaults: at a 1 GiB target the message cap is a quarter and the WAL half of the default, the cap is restored when the target goes back up while the RocksDB options, read at mount, are left alone, and an explicit cap or a bluestore_rocksdb_options set for other reasons is kept. Co-authored-by: Ming Lei <[email protected]> Assisted-by: Claude-Code-v2.1.331:claude-fable-5-2 Signed-off-by: Dan van der Ster <[email protected]>
dvanders
force-pushed
the
wip-osd-memory-scale-wal-msgcap
branch
from
December 1, 2026 22:16
3ce837f to
c20706a
Compare
Contributor
|
Nice, this could really add up on dense archival hosts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second half of #72964, split out as @aclamk asked. It is based on that PR: only the last two commits are new here.
Besides the PG log, two more consumers are bounded by limits sized for the default 4 GiB
osd_memory_targetthat the cache autotuner cannot shrink: the RocksDB WAL and with it the memtables (max_total_wal_size= 1 GiB), and the client message bytes in flight (osd_client_message_size_cap= 500 MiB).Below 4 GiB, while they are at their defaults, the message cap is multiplied by
osd_memory_target / 4 GiBand the WAL by the square root of that ratio (125 MiB and 512 MiB at 1 GiB). The WAL is changed at startup only; abluestore_rocksdb_optionsset for any reason is used as is.Measurements
Both PRs together, the code as it is here with no option set, against #72964 alone and against neither (limits set to today's defaults). vstart, 6 OSDs at a 1 GiB target in a 6 GiB cgroup, 256 PGs each, rbd pool at size 3, a librbd load generator with 16 threads (64 and 256 for the 4M writes), two runs per cell:
So a 1 GiB OSD is over its target without the two PRs and about 220 MiB under it with them, at the same speed except for the 4M writes with 64 in flight, which are 2 to 7% lower in both columns that scale anything. The matrix below, with more runs of that workload, puts that inside the spread between runs (1005 to 1121 MiB/s).
Choosing the WAL size and the message cap
An earlier matrix, on a build of the first version of #72964. Same setup, PG log limits at 75000 / 750 in every run (the final 150000 / 1500 was not chosen yet), two runs per cell (mean):
Not tested: many clients, EC pools, real disks (the OSDs ran on files on one NVMe-backed virtual disk).
unittest_osd_memory_target_defaults3/3.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.
Assisted by Claude Code (Claude Fable 5.2).