Repository navigation
crimson: Support mclock for crimson - #62002
Conversation
There was a problem hiding this comment.
Note: This PR depends on #61647.
Continuing our offline discussion regarding radosbench perf degradation with the changes here. I couldn't spot anything related. The only scheduler user still seems to be BackgroundRecoveryT<T>::start(). I'd suggest retrying with clean main to see if the issue persists there.
I haven't reviewed the overall structure yet but it looks promising! We would probably want to throttle future users/operations with a more generalized way, perhaps by using the PhasedOperationT mechanism.
Followup discussion: We should try to get #61647 merged first.
| int64_t pri = 0; | ||
| get_pgpool().info.opts.get(pool_opts_t::RECOVERY_OP_PRIORITY, &pri); | ||
| return pri > 0 ? pri : crimson::common::local_conf()->osd_recovery_op_priority; | ||
| const std::string _type = this->shard_services.get_cct()->_conf.get_val<std::string>("osd_op_queue"); | ||
| const std::string *type = &_type; | ||
| if (*type == "mclock_scheduler") { | ||
| if (peering_state.is_forced_recovery_or_backfill()) { | ||
| return peering_state.recovery_msg_priority_t::FORCED; | ||
| } else if (peering_state.is_undersized()) { | ||
| return peering_state.recovery_msg_priority_t::UNDERSIZED; | ||
| } else if (peering_state.is_degraded()) { | ||
| return peering_state.recovery_msg_priority_t::DEGRADED; | ||
| } else { | ||
| return peering_state.recovery_msg_priority_t::BEST_EFFORT; | ||
| } | ||
| } else { | ||
| int64_t pri = 0; | ||
| get_pgpool().info.opts.get(pool_opts_t::RECOVERY_OP_PRIORITY, &pri); | ||
| return pri > 0 ? pri : crimson::common::local_conf()->osd_recovery_op_priority; | ||
| } |
There was a problem hiding this comment.
Let's reuse PeeringState::get_recovery_op_priority here.
Conf usage at the end be differed with IFDEF.
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
| int get_val(std::string_view key, std::string *val) const { | ||
| return get_config().get_val(*values, key, val); | ||
| } | ||
|
|
||
| void set_val_default_sync(const std::string& key, const std::string& val) { |
There was a problem hiding this comment.
this is inconsistent with set_val() - observers are not notified of changes made here. how are other cores updated when only shard 0 sets these defaults?
There was a problem hiding this comment.
Need to think about it, during mclock_scheduler it will set on all the shards the issue is during handle_conf_change.
| @@ -683,6 +689,24 @@ seastar::future<> OSD::_send_boot() | |||
| m->metadata["osd_type"] = "crimson"; | |||
| return monc->send_message(std::move(m)); | |||
| } | |||
| seastar::future<bool> OSD::_get_device_type() | |||
| { | |||
| LOG_PREFIX(OSD::_get_device_type); | |||
There was a problem hiding this comment.
this is repeating what _add_device_class does, you can give it a return value or make is_rotational a member of OSD instead
| update_from_config(conf); | ||
| } | ||
|
|
||
| void OperationThrottler::wake() | ||
| { | ||
| WorkItem work_item; | ||
| int i = 0; |
| if (wait_duration.count() > 0) { | ||
| logger().info("No items ready. Retrying wake() in {} ms", wait_duration.count()); | ||
| seastar::sleep(wait_duration).then([this] { | ||
| wake(); |
There was a problem hiding this comment.
instead of recursion, why not continue in the while loop and add the condition that work_item is non-null, like the structure in classic?
|
|
||
| #define dout_context cct | ||
| #define dout_subsys ceph_subsys_osd |
There was a problem hiding this comment.
there's a lot of duplication from classic in this file - is it worth abstracting out key differences so the large common pieces can be shared? e.g. default profiles and config information?
|
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
|
I am working on the same and will refresh a patch after resolve the comments. |
|
Push a patch(#63516) to refactor mclock source code , after backport the same i will refresh the code here. |
c63c8b0 to
51a3ffc
Compare
|
jenkins test make check |
|
jenkins test make check |
51a3ffc to
2645a47
Compare
|
jenkins test make check |
Matan-B
left a comment
There was a problem hiding this comment.
The PR involves changes of common code, introduction of osd member methods, renaming of existing classes and new logic (such as wake_set).
Can you please separate the PR into commits and explain the relevant changes in the commit message? It makes it harder to review otherwise.
| #ifdef WITH_CRIMSON | ||
| auto set_config = [&conf = cct->_conf](const char *key, auto val) { | ||
| return conf.set_val_default_sync(key, std::to_string(val)); | ||
| }; | ||
| #else |
There was a problem hiding this comment.
The same logic applies to Crimson and non-Crimson targets, can we instead introduce a Crimson set_val_default and avoid this ifdef?
| @@ -477,6 +484,7 @@ void MclockConfig::mclock_handle_conf_change(const ConfigProxy& conf, | |||
| // profile defaults by making one of the OSD shards remove the key from | |||
| // config monitor store. Note: monc is included in the check since the | |||
| // mock unit test currently doesn't initialize it. | |||
| #ifndef WITH_CRIMSON | |||
There was a problem hiding this comment.
Can you please explain why is it not needed?
| } | ||
| // Alternatively, the QoS parameter, if set ephemerally for this OSD via | ||
| // the 'daemon' or 'tell' interfaces must be removed. | ||
| #ifndef WITH_CRIMSON |
There was a problem hiding this comment.
After delete a key from in memory the key is automatically reset so we don;t need to run apply_changes. In crimson we don;t have any API yet but it is not required even in case of classic also i think it is not required.
There was a problem hiding this comment.
apply_changes is called each time we change config option to notify the observers and in return call the observer's handle_conf_change. For crimson I think we should probably only skip the "apply_changes" line due to the way rm_val is implemented in Crimson.
| @@ -581,6 +581,14 @@ seastar::future<> OSD::start() | |||
| return _add_me_to_crush(); | |||
| }).then([this] { | |||
| return _add_device_class(); | |||
| }).then([this] { | |||
| if (is_rotational) { | |||
There was a problem hiding this comment.
The above would be true even if is_rotational is false since is_rotational is optional.
Did you mean to check here if it has value or if the value is true?
There was a problem hiding this comment.
In either way, can you please explain the intent here?
There was a problem hiding this comment.
will update in next patch specific to crimson related patch.
There was a problem hiding this comment.
will update in next patch specific to crimson related patch.
Was this addressed?
There was a problem hiding this comment.
The above would be true even if is_rotational is false since is_rotational is optional. Did you mean to check here if it has value or if the value is true?
This wasn't addressed.
| @@ -190,6 +191,7 @@ class OSD final : public crimson::net::Dispatcher, | |||
| seastar::future<> _send_boot(); | |||
| seastar::future<> _add_me_to_crush(); | |||
| seastar::future<> _add_device_class(); | |||
| //#seastar::future<bool> _get_device_type(); | |||
There was a problem hiding this comment.
nit: Do we still need this?
0bd4719 to
87179e5
Compare
|
jenkins test make check |
done |
87179e5 to
daa96cb
Compare
|
jenkins test make check |
Matan-B
left a comment
There was a problem hiding this comment.
Great work, PR is much easier to review! Left final question regarding OperationThrottler::background_task otherwise looks ok.
| if (auto when_ready = std::get_if<double>(&work_item)) { | ||
| ceph::real_clock::time_point future_time = ceph::real_clock::from_double(*when_ready); | ||
| auto now = ceph::real_clock::now(); | ||
| auto wait_duration = std::chrono::duration_cast<std::chrono::milliseconds>(future_time - now); |
There was a problem hiding this comment.
Not sure that this was addressed, we don't check that future_time is later than now and instead unconditionally cast it.. Is this behavior defined?
| auto wait_duration = std::chrono::duration_cast<std::chrono::milliseconds>(future_time - now); | ||
| if (wait_duration.count() > 0) { | ||
| INFO("No items ready. Retrying wake() in {} ms", wait_duration.count()); | ||
| co_await seastar::sleep(wait_duration); |
There was a problem hiding this comment.
See line 190, scheduler->dequeue() is called, later on sleep is called and then continue moved to the next iteration.
The application has to reattempt to dequeue an item
Wasn't the item already dequeued?
AFAIK the future time will be greater than current time even if somehow it is possible it is lower than current time there is no issue. If mclock scheduler is returning floating value after dequeue it means the scheduler has not dequeued an item,the original item is still in the queue. |
daa96cb to
ae2fb34
Compare
|
jenkins test make check |
ae2fb34 to
2e8e206
Compare
Signed-off-by: Mohit Agrawal <[email protected]>
…onal devices, and run OperationThrottler background task Initialize the mClock scheduler on all shards when the device class is non-rotational. If the device is rotational throw an exception to prevent unsupported configurations. In addition, introduce a background task in OperationThrottler that continuously dequeues and schedules client requests from the mClock scheduler based on available credits and throttling limits. Signed-off-by: Mohit Agrawal <[email protected]>
Signed-off-by: Mohit Agrawal <[email protected]>
…roduce get_average_object_size for pg
1) Replace usage of crimson::osd::scheduler::scheduler_class_t
with unified SchedulerClass
2) Add priority to scheduler params structure
3) Introduce get_average_object_size for pg
Signed-off-by: Mohit Agrawal <[email protected]>
The patch is trying to sync mclock source of crimson similar to classic osds. Currently the feature is use by crimson only for background recovery operations but later we will use it for other OSD operations also.To use the same user need to configure crimson_osd_scheduler_concurrency parameter for osd. Replace item_t with WorkItem variant to maintain similarity with classic OSD. Introduce cost and priority as part of item_t. Fixes: https://tracker.ceph.com/issues/67367 Signed-off-by: Mohit Agrawal <[email protected]>
Signed-off-by: Mohit Agrawal <[email protected]>
Signed-off-by: Mohit Agrawal <[email protected]>
2e8e206 to
537465a
Compare
The result is available at https://pulpito.ceph.com/moagrawa-2025-12-03_14:03:13-crimson-rados-main-distro-crimson-debug-smithi/ and details of failed job are also mentioned at https://tracker.ceph.com/projects/crimson/wiki/MAIN |
Thank you for the summary! The test run looks reasonable to me. However, since there are ~5 failures with new trackers I think we should try to further analyze the failures. Especially https://tracker.ceph.com/issues/74084 and https://tracker.ceph.com/issues/74086.
With the two above trackers providing more information, we would be ok to merge. Even if one of them is somewhat related to this PR - I'm ok with merging so that this PR won't need any more rebasing and the issue could be addressed after merge. Please let me know if I can help with analyzing the trackers. |
Sure, though i believe the failure is not related to the PR but we can wait. I will work to resolve the same then we can merge the PR. |
I've retested the PR https://tracker.ceph.com/projects/crimson/wiki/MAIN#httpspulpitocephcommatan-2025-12-07_112602-crimson-rados-wip-moagrawa-crimson-mclock-debug-distro-crimson-debug-smithi - Merging. |
|
This is an automated message by src/script/redmine-upkeep.py. I have resolved the following tracker ticket due to the merge of this PR: No backports are pending for the ticket. If this is incorrect, please update the tracker |
The patch is trying to sync mclock source of crimson similar to classic osds. Currently the feature is use by crimson only for background recovery operations but later we will use it for other OSD operations also.To use the same user need to configure crimson_osd_scheduler_concurrency parameter for osd and the schedule is enabled for the recovery related operations.
Fixes: #https://tracker.ceph.com/issues/67367
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