Skip to content

crimson: Trigger a wake operation via acquire_throttle - #61647

Merged
Matan-B merged 1 commit into
ceph:mainfrom
mohit84:crimson_throttle
Mar 6, 2025
Merged

Matan-B merged 1 commit into
ceph:mainfrom
mohit84:crimson_throttle

Conversation

@mohit84

@mohit84 mohit84 commented Feb 4, 2025 •

Copy link
Copy Markdown
Contributor

The background recovery is not showing any progress for crimson when crimson_osd_scheduler_concurrency is set more than 0. After read the source code it seems the recovery was not showing any progress because initially the queue is empty it was waiting for a future that eventually available after call wake() so call a wake() operation while a queue is empty before enqueue an entry to avoid a circuler dependency issue.

Fixes: https://tracker.ceph.com/issues/69788

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 x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@mohit84
mohit84 requested a review from a team as a code owner February 4, 2025 13:34
@mohit84
mohit84 requested review from Matan-B and athanatos February 4, 2025 13:34
@mohit84

mohit84 commented Feb 4, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@mohit84
mohit84 marked this pull request as draft February 5, 2025 23:49
@mohit84 mohit84 self-assigned this Feb 5, 2025
@mohit84
mohit84 marked this pull request as ready for review February 7, 2025 05:07
@mohit84

mohit84 commented Feb 7, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@mohit84

mohit84 commented Feb 7, 2025

Copy link
Copy Markdown
Contributor Author

I have tested the patch for large pending recovery data something like below

  1. Setup a crimson cluster on latest main branch
    MGR=1 MON=1 OSD=3 MDS=0 ../src/vstart.sh -n --bluestore --crimson --crimson-smp 4 --without-dashboard --debug
  2. Set crimson_osd_scheduler_concurrency for all osd to 5
    ./bin/ceph config set osd.0 crimson_osd_scheduler_concurrency 5
    ./bin/ceph config set osd.1 crimson_osd_scheduler_concurrency 5
    ./bin/ceph config set osd.2 crimson_osd_scheduler_concurrency 5
  3. Create a small pool
    ./bin/ceph osd pool create test 128 128 replicated
  4. Populate some data
    ./bin/rados -c /nvme0/ceph/build/ceph.conf -p test bench -b 4096 60 write --concurrent-ios 8 --no-cleanup
  5. stop osd.0
    ./bin/ceph osd out 0
    ./bin/ceph osd stop 0
  6. Then again populate some data
    ./bin/rados -c /nvme0/ceph/build/ceph.conf -p test bench -b 4096 600 write --concurrent-ios 8 --no-cleanup
  7. mark osd.0 to in
    ./bin/ceph osd in 0
  8. Run a python script to capture recovery related metrics from other terminal
  9. Start the osd.0 again manually
    /bin/sh /nvme0/ceph/src/ceph-run /nvme0/ceph/build/bin/crimson-osd --debug -i 0 -c /nvme0/ceph/build/ceph.conf -f
  10. Monitor the performance and avg performance is like below
    Scheduler(mclock)
    {
    "avg_recovering_objects_per_sec": 553.89975399754,
    "avg_recovering_bytes_per_sec": 2270779.0879458794,
    "avg_num_objects_recovered": 5469.426199261992,
    "avg_num_bytes_recovered": 22402749.677736778
    }
    No scheduler(default)
    {
    "avg_recovering_objects_per_sec": 425.87915652879155,
    "avg_recovering_bytes_per_sec": 1746451.5328467153,
    "avg_num_objects_recovered": 3914.354420113544,
    "avg_num_bytes_recovered": 16033175.88969992
    }

Comment thread src/crimson/osd/osd_operation.h Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we do need to increment in_progress here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we take the acquire_throttle path below, wake() always increments in_progress when it wakes the item. This path should be symmetric, if we return std::nullopt, we're telling the caller that it did acquire the throttle, so we need to behave the same way.

The bug is probably that 14e068f didn't introduce a mechanism to release the throttle. Prior to that commit, the only way to acquire throttle was via with_throttle_while which guaranteed that release_throttle would be invoked after the passed function executed.

@xuxuehan Perhaps there's a mechanism to release the throttle I'm missing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are correct here we missed to release a throttle. I thin we can call wait() before return nullopt otherwise it will be like a deadlock kind of situation. A backfill call try_acquire_throttle_now() via budget_available() and gets immediately success(std::nullopt) and in_progress increase before any pending operation in scheduler are woken up. The pending operations in scheduler remain stuck because wake() does not get a chance to run due to condition check (in_progress < max_in_progress) is failed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but if it takes the other pathway, it'll leak an in_progress because acquire_throttle always increments it. As long as backfill doesn't release the throttle (at present, there isn't even an interface to do so, release_throttle() is private...), it seems impossible to use try_acquire_throttle_now() usefully.

I think the only fix for now is to comment out the code in budget_available() and have it unconditionally return true until we add a mechanism for that interface to release the throttle (ideally by returning a ThrottleHandle RAII object which does it in the destructor).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to call it release_throttle after make it public but i am not getting any progress in recovery. Need to spend more time to resolve it, for the time being i will comment a code in budget_available().

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we take the acquire_throttle path below, wake() always increments in_progress when it wakes the item. This path should be symmetric, if we return std::nullopt, we're telling the caller that it did acquire the throttle, so we need to behave the same way.

The bug is probably that 14e068f didn't introduce a mechanism to release the throttle. Prior to that commit, the only way to acquire throttle was via with_throttle_while which guaranteed that release_throttle would be invoked after the passed function executed.

@xuxuehan Perhaps there's a mechanism to release the throttle I'm missing?

Sorry for the late reply, I missed this comment.
I think I forgot to implement the releasing in that PR after a major modification. Will add it soon.

Comment thread src/crimson/osd/osd_operation.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix is unrelated to the in_progress change, but seems correct. Calling wake() unconditionally would also work.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to pull this out into its own PR. Generally, try not mix unrelated fixes into the same commit.

Comment thread src/crimson/osd/osd_operation.h Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this is reasonable -- I think I meant this for debugging purposes but we can always readd it later. Same comment as above though, it's unrelated to the other two changes and should be in its own commit (fine to include it as part of a larger PR though).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I would prefer keeping it for logging purposes. It's probably also a good opportunity to add more logs around other OperationThrottler functions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would handle it via separate PR.

@mohit84

mohit84 commented Feb 12, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@mohit84 mohit84 changed the title crimson: Trigger a wake operation via acquire_throttle if queue is empty crimson: Trigger a wake operation via acquire_throttle Feb 12, 2025
@mohit84

mohit84 commented Feb 19, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@Matan-B Matan-B left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should separate the commit here into two:

  1. call wake unconditionally
  2. hide out budget_available code due to to the bug described.
    Can you please also introduce a ticket (explaining why this is commented out) referenced as a comment for future readers? That way we could track this as needed to be implemented.

@Matan-B Matan-B mentioned this pull request Feb 26, 2025
14 tasks
The background recovery is not showing any progress for crimson when
crimson_osd_scheduler_concurrency is set more than 0. After read the
source code it seems the recovery was not showing any progress because
initially the queue is empty it was waiting for a future that eventually
available after call wake() so call a wake() operation to return a future.

Fixes: https://tracker.ceph.com/issues/69788
Signed-off-by: Mohit Agrawal <[email protected]>
@mohit84

mohit84 commented Feb 26, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@Matan-B

Matan-B commented Mar 5, 2025

Copy link
Copy Markdown
Contributor

jenkins test api

@Matan-B

Matan-B commented Mar 5, 2025

Copy link
Copy Markdown
Contributor

jenkins test make check arm64

@Matan-B

Matan-B commented Mar 5, 2025

Copy link
Copy Markdown
Contributor

@Matan-B

Matan-B commented Mar 6, 2025 •

Copy link
Copy Markdown
Contributor

https://pulpito.ceph.com/matan-2025-03-05_14:58:30-crimson-rados-wip-matanb-crimson-only-testing-5-mar-distro-crimson-smithi/

8171870 - https://tracker.ceph.com/issues/70337 pglog_based_recovery_op
8171893 - https://tracker.ceph.com/issues/69438 bluestore unexpected error
8171931, 8171935 - https://tracker.ceph.com/issues/69439 osd.1 trim_to <= peering_state.get_pg_committed_to()
8171944 - https://tracker.ceph.com/issues/69612 SLOW_OPS
8171949 - https://tracker.ceph.com/issues/67972 FAILED ceph_assert(omap.size() == old_value.attrs.size())
8171956 - https://tracker.ceph.com/issues/69406 waiting on 1

@Matan-B
Matan-B merged commit 5579c10 into ceph:main Mar 6, 2025
@Matan-B Matan-B moved this from Needs QA to Merged in Crimson Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Merged (Pre Tentacle Freeze)

Development

Successfully merging this pull request may close these issues.

4 participants