Skip to content

umbrella: osd/scheduler: Classify subOp reads according to op priority for mClock - #69761

Merged
batrick merged 8 commits into
ceph:umbrellafrom
sseshasa:wip-77728-umbrella
Sep 29, 2026
Merged

batrick merged 8 commits into
ceph:umbrellafrom
sseshasa:wip-77728-umbrella

Conversation

@sseshasa

@sseshasa sseshasa commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

backport tracker: https://tracker.ceph.com/issues/77728


backport of #64618
parent tracker: https://tracker.ceph.com/issues/71655

this backport was staged using ceph-backport.sh version 16.0.0.6848
find the latest version at https://github.com/ceph/ceph/blob/main/src/script/ceph-backport.sh

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

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

sseshasa and others added 8 commits June 26, 2026 13:52
The earlier output formatting was resulting in the value and string
representation of the SchedulerClass being clubbed together for
e.g., "3client"

The formatting is now fixed to log SchedulerClass as "3 (client)".

Signed-off-by: Sridhar Seshasayee <[email protected]>
(cherry picked from commit 0b84dbe)
Signed-off-by: Sridhar Seshasayee <[email protected]>
(cherry picked from commit 89c7b21)
Signed-off-by: Sridhar Seshasayee <[email protected]>
(cherry picked from commit 913e891)
…Clock

The change brings MSG_OSD_EC_READ into the fold of mClock scheduler. This
improves the scheduling of client and other classes of operation as they
are no longer unnecessarily preempted by the 'immediate' queue.
EC SubOps are now handled as follows:

 - EC SubOp reads generated during recovery will either go into the
   'background_recovery' or 'background_best_effort' class based on
   the recovery priority set for the op. EC SubOp reads generated due
   to client will continue to be classified as 'immediate'.

 - EC SubOp writes generated as a result of client operations will
   continue to be classified as 'immediate'.

 - EC SubOp replies are considered high priority and therefore
   continue to be classed as 'immediate'.

Fixes: https://tracker.ceph.com/issues/71655
Signed-off-by: Sridhar Seshasayee <[email protected]>
(cherry picked from commit a0464c3)
…cheduler

Previously, sub-op reads returned a hardcoded cost of 0, bypassing
mClock's background bandwidth and tag calculation mechanisms. This
allowed backfill operations to proceed un-metered, occasionally causing
backend resource contention and driving up client tail latencies.

Cost is calculated based on whether the complete chunk/shard or a subchunk
needs to be read. The possible cases are:
1. Read the complete chunk aligned length:
   - Cost is set to the length of the chunk aligned extent size.
2. Fragmented reads:
   - Consider the subchunk length and count to calculate the cost.
   - compute_cost evaluates the exact layout of fragmented shard bytes on
     disk by summing up the active subchunk allocations exactly once
     (`fragmented_shard_bytes += k.second * subchunk_size`).
   - Linear Extent Scaling: Scale the baseline footprint cleanly by
     multiplying it against the true count of read extents (`tl.size()`),
     achieving a highly efficient O(N) time complexity.

This linear cost model is compatible with pools running with
'allow_ec_optimizations' set to true. Under the FastEC optimized
pipeline, most operations are unified and bypass fragment slicing,
meaning requests will primarily match the Case 1 chunk-aligned path.
In Case 2 where applicable, the O(N) loop ensures that cost will
scale proportionally according to the layout.

It is important to note that the amount of data to read was set to an upper
bound defined by osd_recovery_max_chunk (8 MiB) and was rounded up to the
stripe width. The reason for setting a higher than actual upper bound is that
there may be cases where the object doesn't have the xattrs yet to determine
its size. Therefore, the amount to read was ultimatly set to ~(8 MiB / k)
where k is the number of data shards. This can cause mClock to prolong
the recovery times as items stay longer in the queue. To address this, the
amount to read is set to the remaining length of the object to recover
if the object size is known. Otherwise, the amount to read is set to the
recovery chunk size as before. Therefore, in some cases, only the first
recovery read could be costly if the object context is not known.

The MOSDECSubOpRead class introduces the following:
 - cost member. This necessitates an increment to the HEAD_VERSION and
   appropriate handling within the encode and decode methods.
 - compute_cost() that is called when creating the message by
   ECCommonL::ReadPipeline::do_read_op(). This calls into ECSubRead::cost()
   that performs the actual calculations to set the cost based on the cases
   mentioned above.
 - The same sequence applies to the EC optimized path in
   ECCommon::ReadPipeline::do_read_op().

Fixes: https://tracker.ceph.com/issues/71655
Signed-off-by: Sridhar Seshasayee <[email protected]>
(cherry picked from commit e79befe)
Add perf counters to show the status pertaining to the number of ops,
dynamic queue lengths, queue latency and bytes read for the following
ops handled in the high queues and in the scheduler queues:
 - peering
 - client
 - ec reads/writes
 - ec recovery reads

Additional counters can be added in the future based on the requirement.

Signed-off-by: Sridhar Seshasayee <[email protected]>
(cherry picked from commit 5ae7768)
…tarvation

Adjust the 'background_best_effort' queue parameters across the
three standard mClock profiles (high_client_ops, balanced, and
high_recovery_ops) to ensure best effort ops are not starved.

Previously, the 'background_best_effort' queue carried a default allocation
of 0% (MIN) reservation and a weight of 1 under these profiles. When
concurrent client traffic is dense, the zero-reservation for example completely
starves backfill sub-ops (MSG_OSD_EC_READ) on pools with
'allow_ec_optimizations' set to false. This starvation forces the Primary OSD
to hold internal BlueStore transactions and PG object locks for extended
windows, causing severe client median (50th) latency inflation.

To prevent background starvation and resolve the effects of the primary lock
retention, the profile configurations are tuned as follows:

The following profile changes forces low-cost sub-ops to clear out of peer
queues rapidly to drop  primary locks, which helps improve the client
completion latency and tail latency (95th, 99th and 99.5th) percentile.

1. high_client_ops profile:
   - Grant 'background_best_effort' a safe 5% minimum reservation.
   - Scale the queue weight to 4.

2. balanced profile:
   - Grant 'background_best_effort' a 5% minimum reservation.
   - Set the queue weight to 2.

3. high_recovery_ops profile:
   - Grant 'background_best_effort' a 5% minimum reservation.
   - Set the queue weight to 2.

4. Modify the mClock config reference documentation to reflect the tuning
   changes to the best-effort QoS parameters across the profiles.

Note on Proportional Scaling Compatibility:
Configuring these changes shifts total reservations to 105% (e.g., 50%
client + 50% recovery + 5% best-effort under the Balanced profile). Under
heavy concurrent saturation, mClock's internal controls resolves this
gracefully via proportional down-scaling, preserving the underlying
device bandwidth limits for different classes of clients. For example instead
of the client being allocated 50% bandwidth, a slightly lower reservation is
allocated while shifting the remaining bandwidth to the best-effort queue.
This minor scaling shift is virtually unnoticeable to the client application,
but it prevents the internal queue deadlocks.

Signed-off-by: Sridhar Seshasayee <[email protected]>
(cherry picked from commit 77421c8)
…sters

Remove the warning that recommends using wpq scheduler as a fallback for EC
clusters. This issue is addressed by considering EC recovery reads as
background, assigning an accurate cost for those reads and tuning the QoS
parameters associated with best-effort class of operations.

Signed-off-by: Sridhar Seshasayee <[email protected]>
(cherry picked from commit 2cf1e71)
@sseshasa
sseshasa requested review from a team as code owners June 26, 2026 08:22
@sseshasa sseshasa added this to the umbrella milestone Jun 26, 2026
@sseshasa sseshasa added the core label Jun 26, 2026
github-actions[bot]

This comment was marked as outdated.

@github-actions github-actions Bot added the releng-audit-fail Release engineering: failed backport verification audit. label Jun 26, 2026
@sseshasa sseshasa removed the releng-audit-fail Release engineering: failed backport verification audit. label Jun 26, 2026
@github-actions github-actions Bot added the releng-audit-pass Release engineering: passed backport verification audit. label Jun 26, 2026
@sseshasa
sseshasa requested a review from rzarzynski June 26, 2026 08:34
@sseshasa

Copy link
Copy Markdown
Contributor Author

@rzarzynski Please review this backport. The releng-audit failed initially since the umbrella had no 'Pull Request ID' field set. It is now set and all the commits were cherry-picked without any conflict. Thanks!

@sseshasa sseshasa modified the milestones: umbrella, v21.1.0 Jun 29, 2026
@sseshasa sseshasa added the backport umbrella This is a backport targeting Umbrella. label Jun 30, 2026
@sseshasa

sseshasa commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@sseshasa sseshasa added DNM and removed needs-qa labels Jul 8, 2026
@sseshasa

sseshasa commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

I have marked this PR as DNM until we get confirmation from QE that the fix works well on a larger cluster involving HDDs.

@batrick batrick removed this from the v21.1.0 milestone Jul 20, 2026
@batrick batrick added this to the v21.1.1 milestone Jul 20, 2026
@batrick batrick added the releng-audit-queue Release engineering: queued for backport verification audit. label Jul 20, 2026
@github-actions github-actions Bot removed the releng-audit-queue Release engineering: queued for backport verification audit. label Jul 20, 2026
@batrick batrick added needs-qa releng-audit-queue Release engineering: queued for backport verification audit. labels Jul 20, 2026
@github-actions github-actions Bot added releng-audit-pass Release engineering: passed backport verification audit. and removed releng-audit-pass Release engineering: passed backport verification audit. releng-audit-queue Release engineering: queued for backport verification audit. labels Jul 20, 2026
@yuriw

yuriw commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-yuri15-testing-20260723.210930-umbrella.

@sseshasa

Copy link
Copy Markdown
Contributor Author

This PR has been added to wip-yuri15-testing-20260723.210930-umbrella.

@yuriw @batrick This can go through teuthology testing, but the merge can wait until I get confirmation of results from a larger testing effort underway on a HDD based cluster. I have modified the commit title accordingly.

@sseshasa sseshasa changed the title umbrella: osd/scheduler: Classify subOp reads according to op priority for mClock [DO NOT MERGE] umbrella: osd/scheduler: Classify subOp reads according to op priority for mClock Jul 24, 2026
@sseshasa sseshasa changed the title [DO NOT MERGE] umbrella: osd/scheduler: Classify subOp reads according to op priority for mClock [Do Not Merge] umbrella: osd/scheduler: Classify subOp reads according to op priority for mClock Jul 24, 2026
@batrick

batrick commented Jul 30, 2026

Copy link
Copy Markdown
Member

jenkins test make check arm64

@batrick

batrick commented Aug 5, 2026 •

Copy link
Copy Markdown
Member

@yuriw @batrick This can go through teuthology testing, but the merge can wait until I get confirmation of results from a larger testing effort underway on a HDD based cluster. I have modified the commit title accordingly.

then it should not block umbrella? Let's move it out?

@ljflores

ljflores commented Aug 5, 2026

Copy link
Copy Markdown
Member

@sseshasa

sseshasa commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor Author

then it should not block umbrella? Let's move it out?

@batrick Yes, it can be moved out until we have the results from testing.

@sseshasa

sseshasa commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

then it should not block umbrella? Let's move it out?

@batrick Yes, it can be moved out until we have the results from testing.

@batrick Downstream testing on HDDs passed. This PR can therefore be merged when the next umbrella window opens up. The PR was RADOS approved.

@sseshasa sseshasa changed the title [Do Not Merge] umbrella: osd/scheduler: Classify subOp reads according to op priority for mClock umbrella: osd/scheduler: Classify subOp reads according to op priority for mClock Sep 16, 2026
@batrick
batrick merged commit f553b93 into ceph:umbrella Sep 29, 2026
45 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport umbrella This is a backport targeting Umbrella. common core documentation ready-to-merge releng-audit-pass Release engineering: passed backport verification audit.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants