Repository navigation
Conversation
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: ['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)
! 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 by ``osd_memory_target`` / 4 GiB while they are at their defaults: ``osd_client_message_size_cap``, ``osd_target_pg_log_entries_per_osd`` and ``osd_pg_log_dups_tracked``, and, by the square root of that ratio and when the OSD starts, the RocksDB ``max_total_wal_size``. 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 by osd_memory_target / 4 GiB while they are at their defaults: osd_client_message_size_cap, osd_target_pg_log_entries_per_osd and osd_pg_log_dups_tracked, and, by the square root of that ratio and when the OSD starts, the RocksDB max_total_wal_size. A value set explicitly is used as is. (global.yaml.in)
The above configuration changes are found in the PR. Please update the relevant release documentation if necessary. |
|
The approach makes sense: the autotuner can only shrink the caches, and the PG log, client throttle and memtables are what actually grow at a small target. One bug in Suggest parsing the merged string ( One point for discussion: do we need |
9bac776 to
8aaf994
Compare
|
Thanks @ming1, good catch on the WAL parsing. Fixed: the value is now read with On the option: agreed, scaling only what's still at its default is better. Done in the same push: explicitly set values are used as is, and |
|
Thanks, the parser-based WAL read and dropping the option both look right, and you're correct that a bare space isn't a separator for Two things remain:
|
|
Thanks @ming1, both done in a9e9bf2:
And thanks for #73018. I'll review it and run it through the same hot-read benchmark. |
8aaf994 to
a9e9bf2
Compare
|
Thanks for the update. One thought on simplifying further: the config system already has the "scale while at default, explicit wins" rule. If the OSD lowers the defaults with // ceph_osd.cc, right after global_init(); again from handle_conf_change() on osd_memory_target
for (key : {osd_client_message_size_cap, osd_target_pg_log_entries_per_osd, osd_pg_log_dups_tracked})
conf.set_val_default(key, to_string(default(key) * scale));
// at startup only: max_total_wal_size rewritten inside the default bluestore_rocksdb_options stringA CONF_DEFAULT value yields to any higher level, so an explicit value is kept even when it equals the default (which the release note promises), For reference only, two commits (code, tests): https://github.com/ming1/ceph/commits/wip-72964-simple. Verified on a vstart cluster at 1 GiB including live target changes, and the 1 GiB OSD survives the 4K write run that OOM-killed it before. |
a9e9bf2 to
2a2f6be
Compare
|
Thanks @ming1, that's much simpler. I've taken your two commits (with you as co-author), and the PR is now just On a vstart OSD: 1 GiB at runtime gives 125 MiB / 75000 / 750; after a restart the WAL is 512 MiB, and RocksDB reports it too; 2 GiB and 4 GiB scale back up; explicitly set values (including dups at its default, 3000) are kept, and once they're removed it falls back to the scaled default. |
|
/config check ok |
|
I feel like this PR is logically 2 parts: Part one of this PR is doing scaling of Part two of this PR is I believe we should split this PR. |
Ceph PR triage — related open PRsQueried #72964 against KB snapshot
This comment is updated in place when the workflow re-runs (hidden HTML marker). Data: read-only GitHub + local git analysis; no labels or merges were changed. |
2a2f6be to
d1cd80f
Compare
|
Thanks @aclamk, done as you suggest. This PR is now the PG log part only. I ran the catch-up test: with the limits scaled by the ratio, even a 10 s restart of an OSD under 4K writes backfilled 192 of about 230 PGs, against 6 with the default log. So they are scaled by the square root now (118 backfilled), which still halves the PG log (113-131 MiB per OSD against 216-252 MiB). The table is in the description. This half alone does not get a 1 GiB OSD under its target; that needs the other one. The message cap and the WAL are in #74625, with the WAL size x message cap x workload matrix. Short version: with both, a 1 GiB OSD peaks at about 800 MiB against 1050 MiB today; throughput is flat, the WAL sets the memory, a 256 MiB WAL raises the 4K write p99.9, and the message cap made no difference with one client. |
| the values specified in the ``bluestore_cache_meta_ratio`` and | ||
| ``bluestore_cache_kv_ratio`` options are used as fallback cache ratios. | ||
|
|
||
| The caches are not the only memory an OSD uses. The PG log is bounded by |
There was a problem hiding this comment.
I think the whole section is too important to be a side note.
Also, it applies to both automatic and manual cache sizing.
Let's make it a separate topic.
Most likely we will identify more things to scale in the future.
There was a problem hiding this comment.
Done: it is a section of its own now, "Limits Scaled with the Memory Target", with a table of the limits, their defaults and how each is scaled, so more can be added. It also says that this applies with automatic and with manual cache sizing. #74625 adds its two rows to the same table.
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]>
d1cd80f to
48c9628
Compare
Follow-up to the review of #72884. Split from the original version of this PR as @aclamk asked: this is the PG log part; the client message cap and the RocksDB WAL are in #74625.
The cache autotuner keeps an OSD near
osd_memory_targetby shrinking its caches, but the PG log is bounded by limits sized for the default 4 GiB target (300k entries per OSD, 3000 dups 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 4 GiB, the defaults of
osd_target_pg_log_entries_per_osdandosd_pg_log_dups_trackedare now multiplied by the square root ofosd_memory_target / 4 GiB(150000 and 1500 at 1 GiB). A value set explicitly is used as is, which is also how to opt out. At or above 4 GiB nothing changes.Why the square root
A shorter log turns the log recovery of a restarted OSD into backfill. vstart, 6 OSDs at a 1 GiB target in a 6 GiB cgroup, 256 PGs each, rbd pool at size 3, 4K random writes (about 4.8k IOPS, 9 per second and PG); one OSD is killed, and restarted after N seconds. PGs backfilled / PGs recovered from the log only, of about 230 on that OSD, one run each. All three runs had the WAL at 512 MiB and the message cap at 125 MiB, the values of the follow-up PR:
So the square root halves the PG log and backfills about half of the PGs after a short restart, where scaling by the ratio backfilled most of them. It is still far from the default log, which the release note says.
On its own this PR does not bring a 1 GiB OSD under its target: with the WAL and the message cap at today's defaults, a shorter mixed workload (the one in the follow-up PR, two runs) peaked at 1022 to 1040 MiB per OSD, against 1052 to 1062 MiB without this PR and 795 to 806 MiB with both PRs. "Down" is the time between kill -9 and the restart; boot and peering come on top. Time to clean was 37 to 44 s in every case, which says little: the image was 8 GiB, about 16 MiB per PG.
Not tested: a less busy pool (all three columns move towards log recovery), EC pools, real disks.
unittest_osd_memory_target_defaults3/3,unittest_pglog61/61.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).