Skip to content

crimson: Use OperationThrottle for backfill operation#62238

Closed
mohit84 wants to merge 1 commit intoceph:mainfrom
mohit84:backfill_use_throttle
Closed

crimson: Use OperationThrottle for backfill operation#62238
mohit84 wants to merge 1 commit intoceph:mainfrom
mohit84:backfill_use_throttle

Conversation

@mohit84
Copy link
Contributor

@mohit84 mohit84 commented Mar 12, 2025

During on_backfill_reserved call try_acquire_throttle before proceed a backfill operation, If it returns null it means throttle is disabled otherwise triggered a BackfillState.

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

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

During on_backfill_reserved call try_acquire_throttle before
proceed a backfill operation, If it returns null it means throttle
is disabled otherwise triggered a BackfillState.

Fixes: https://tracker.ceph.com/issues/70395
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
@mohit84 mohit84 requested a review from a team as a code owner March 12, 2025 04:09
@mohit84 mohit84 requested a review from Matan-B March 12, 2025 04:09
@mohit84
Copy link
Contributor Author

mohit84 commented Mar 12, 2025

jenkings test make check

@Matan-B Matan-B added this to Crimson Mar 12, 2025
@Matan-B Matan-B moved this to Awaits review in Crimson Mar 12, 2025
@Matan-B Matan-B requested a review from xxhdx1985126 March 12, 2025 08:46
@mohit84
Copy link
Contributor Author

mohit84 commented Mar 12, 2025

jenkins test make check

@xxhdx1985126
Copy link
Contributor

xxhdx1985126 commented Mar 13, 2025

IIUC, this PR is treating the whole backfill of a PG as a single backfill operation, which can contain tens of thousands of pushes and objectstore transactions. I think it is too large to be treated as a single operation. The whole backfill is splitted into multiple batches of pushes, so we should probably treat a batch of those pushes as a single operation instead.

@mohit84
Copy link
Contributor Author

mohit84 commented Mar 27, 2025

IIUC, this PR is treating the whole backfill of a PG as a single backfill operation, which can contain tens of thousands of pushes and objectstore transactions. I think it is too large to be treated as a single operation. The whole backfill is splitted into multiple batches of pushes, so we should probably treat a batch of those pushes as a single operation instead.

I am not sure it would be a good idea to use throttle future in multiple batches. The "BackfillState::Enqueuing::Enqueuing" state is doing other time consuming activity also like should_rescan_primary . If we do breakup function(Enqueuing) in multiple task and spawn under throttle it will be a complex and difficult to maintain. If we do check classic osd code also in recover_backfill it is backfilled all objects in one shot specific to a PG so i believe current behavior is similar to classic OSD. We can check later if we will find some issue.

@Matan-B Can you please share your view on the same ?

@xxhdx1985126
Copy link
Contributor

IIUC, this PR is treating the whole backfill of a PG as a single backfill operation, which can contain tens of thousands of pushes and objectstore transactions. I think it is too large to be treated as a single operation. The whole backfill is splitted into multiple batches of pushes, so we should probably treat a batch of those pushes as a single operation instead.

I am not sure it would be a good idea to use throttle future in multiple batches. The "BackfillState::Enqueuing::Enqueuing" state is doing other time consuming activity also like should_rescan_primary . If we do breakup function(Enqueuing) in multiple task and spawn under throttle it will be a complex and difficult to maintain. If we do check classic osd code also in recover_backfill it is backfilled all objects in one shot specific to a PG so i believe current behavior is similar to classic OSD. We can check later if we will find some issue.

A single run of Enqueuing is a single batch of object pushes, the backfill is splitted into multiple batches by the multiple Enqueuing run. The classic OSD also split the backfill into multiple batches, which is controlled by osd_recovery_max_single_start and osd_recovery_max_active.

@Matan-B
Copy link
Contributor

Matan-B commented Mar 31, 2025

A single run of Enqueuing is a single batch of object pushes, the backfill is splitted into multiple batches by the multiple Enqueuing run. The classic OSD also split the backfill into multiple batches, which is controlled by osd_recovery_max_single_start and osd_recovery_max_active.

@mohit84, Looking at Classic:
We call start_recovery_ops with the passed reserved_pushes.
reserved_pushes is set via:

    uint64_t to_start = std::min(
      available_pushes,
      cct->_conf->osd_recovery_max_single_start);

Later on, when we actually backfill see PrimaryLogPG::start_recovery_op we use the reserved_pushes as max.
In recover_replicas or recover_primary and most notably in `PrimaryLogPG::recover_backfill the backfill interval iteration is limited with:

while (ops < max) {

Going back to the comment above:

If we do check classic osd code also in recover_backfill it is backfilled all objects in one shot specific to a PG so i believe current behavior is similar to classic OSD.

Classic does limit the object backfilled in _maybe_queue_recovery by using both the osd_recovery_max_active and the osd_recovery_max_single_start.
Note: Crimson's throttle is defined in PerShardState::throttler meaning we should be able to throttle the backfill interval per shard.

Once we would support both configurables we could pick to_start, similarly to classic, "std::min" above.

(CC: @sseshasa)

@Matan-B Matan-B moved this from Awaits review to Unassigned in Crimson Apr 3, 2025
@mohit84
Copy link
Contributor Author

mohit84 commented Apr 3, 2025

The issue is fixed by the pull request #62080 so i am closing this.

@mohit84 mohit84 closed this Apr 3, 2025
@Matan-B Matan-B removed this from Crimson Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants