osd: avoid costly md_config_t::get_val<>() when preparing stats#60610
osd: avoid costly md_config_t::get_val<>() when preparing stats#60610
Conversation
src/common/options/global.yaml.in
Outdated
| are collected. | ||
| default: 500 | ||
| with_legacy: false | ||
| with_legacy: true |
There was a problem hiding this comment.
Officially, we do not add new legacy options:
ceph/src/common/config_values.h
Lines 36 to 40 in a8e43a9
You can load these via OSD::handle_conf_change.
There was a problem hiding this comment.
Ouch, moved to md_config_cacher_t.
8be7014 to
f1621c1
Compare
batrick
left a comment
There was a problem hiding this comment.
Didn't know about md_config_cacher_t, nice! That only works for primitive types, right? (i.e. not std::string)
|
This is a question about |
src/osd/PeeringState.cc
Outdated
| epoch_t cutoff_epoch = info.stats.reported_epoch; | ||
| cutoff_epoch += | ||
| cct->_conf.get_val<int64_t>("osd_pg_stat_report_interval_max_epochs"); | ||
| static_cast<int64_t>(osd_pg_stat_report_interval_max_epochs); |
There was a problem hiding this comment.
There is an error in the Shaman build related to this change:
https://shaman.ceph.com/builds/ceph/wip-yuri4-testing-2025-01-13-1147/
19.3.0-6882-gb9fe3ef7/src/osd/PeeringState.cc
/home/jenkins-build/build/workspace/ceph-dev-new-build/ARCH/x86_64/AVAILABLE_ARCH/x86_64/AVAILABLE_DIST/centos9/DIST/centos9/MACHINE_SIZE/gigantic/release/19.3.0-6882-gb9fe3ef7/rpm/el9/BUILD/ceph-19.3.0-6882-gb9fe3ef7/src/osd/PeeringState.cc: In member function ‘std::optional<pg_stat_t> PeeringState::prepare_stats_for_publish(const std::optional<pg_stat_t>&, const object_stat_collection_t&)’:
/home/jenkins-build/build/workspace/ceph-dev-new-build/ARCH/x86_64/AVAILABLE_ARCH/x86_64/AVAILABLE_DIST/centos9/DIST/centos9/MACHINE_SIZE/gigantic/release/19.3.0-6882-gb9fe3ef7/rpm/el9/BUILD/ceph-19.3.0-6882-gb9fe3ef7/src/osd/PeeringState.cc:3934:7: error: invalid ‘static_cast’ from type ‘md_config_cacher_t<long int>’ to type ‘int64_t’ {aka ‘long int’}
3934 | static_cast<int64_t>(osd_pg_stat_report_interval_max_seconds);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jenkins-build/build/workspace/ceph-dev-new-build/ARCH/x86_64/AVAILABLE_ARCH/x86_64/AVAILABLE_DIST/centos9/DIST/centos9/MACHINE_SIZE/gigantic/release/19.3.0-6882-gb9fe3ef7/rpm/el9/BUILD/ceph-19.3.0-6882-gb9fe3ef7/src/osd/PeeringState.cc:3943:7: error: invalid ‘static_cast’ from type ‘md_config_cacher_t<long int>’ to type ‘int64_t’ {aka ‘long int’}
3943 | static_cast<int64_t>(osd_pg_stat_report_interval_max_epochs);
There was a problem hiding this comment.
missing the '*' (should be *osd_pg...)
ronen-fr
left a comment
There was a problem hiding this comment.
missing the '*' (should be *osd_pg...)
|
Ah, there was the cacher's API change. I bet it merged earlier resulting in undetected merge conflict. I will fix. |
It's know that the `md_config_t::get_val<>()` method template is costly and should be avoided on hot paths. Recent profiling[1] by Mark Kogani has shown that, on RGW's bucket listing, an OSD had burnt 2,87% of CPU cycles on `get_val<long>()` in `PG::prepare_stats_for_publish()`. [1]: ceph#60278 (comment) Fixes: https://tracker.ceph.com/issues/69657 Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
f1621c1 to
39a12b5
Compare
|
Rebased to fresh |
|
jenkins test api |
|
jenkins test make check arm64 |
It's know that the
md_config_t::get_val<>()method template is costly and should be avoided on hot paths.Recent profiling1 by Mark Kogan has shown that, on RGW's bucket listing, an OSD had burnt 2,87% of CPU cycles on
get_val<long>()inPG::prepare_stats_for_publish().Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e