Skip to content

Add throughput bucket support for Change Feed Processor feed polling#49583

Open
arnabnandy7 wants to merge 16 commits into
Azure:mainfrom
arnabnandy7:feature/cfp-throughput-bucket-support_49487
Open

Add throughput bucket support for Change Feed Processor feed polling#49583
arnabnandy7 wants to merge 16 commits into
Azure:mainfrom
arnabnandy7:feature/cfp-throughput-bucket-support_49487

Conversation

@arnabnandy7

Copy link
Copy Markdown
Contributor

Description

Adds throughput bucket support for Change Feed Processor feed polling throughput control in Azure Cosmos DB.

When a CFP feed poll throughput control config includes throughputBucket, CFP now enables server-side throughput control for the configured group instead of only using local/client-side throughput control. This is implemented for both PK-range and EPK-range CFP paths.

Also adds unit coverage for both CFP paths and updates the Cosmos changelog.

Fixes #49487

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI review requested due to automatic review settings June 21, 2026 20:04
@arnabnandy7 arnabnandy7 requested review from a team and kirankumarkolli as code owners June 21, 2026 20:04
@github-actions github-actions Bot added Community Contribution Community members are working on the issue Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Jun 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution @arnabnandy7! We will review the pull request and get back to you soon.

Copilot AI 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.

Pull request overview

Adds Change Feed Processor (CFP) support for throughput buckets by enabling server-side throughput control groups when ThroughputControlGroupConfig.throughputBucket is configured, covering both PK-range and EPK-range CFP implementations.

Changes:

  • Enable enableServerThroughputControlGroup(...) for CFP feed polling when throughputBucket is set (PK-range + EPK-range paths).
  • Add unit tests validating server throughput control group enablement for both CFP paths when throughputBucket is configured.
  • Document the feature addition in the Cosmos SDK changelog.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/pkversion/FeedRangeThroughputControlConfigManager.java Switches CFP PK-range path to enable server throughput control when throughputBucket is present.
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/FeedRangeThroughputControlConfigManager.java Adds one-time enablement of server throughput control for throughput-bucket configs in CFP EPK-range path.
sdk/cosmos/azure-cosmos/CHANGELOG.md Notes the new CFP throughput bucket support.
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/changefeed/pkversion/FeedRangeThroughputControlConfigManagerTests.java Adds unit coverage for throughput-bucket behavior (PK-range path).
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/changefeed/epkversion/FeedRangeThroughputControlConfigManagerTests.java Adds unit coverage for throughput-bucket behavior (EPK-range path).

Copilot AI 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.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Copilot AI 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.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Copilot AI 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.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Comment thread sdk/cosmos/azure-cosmos-spark_3/pom.xml Outdated
private final AtomicReference<List<FeedRangeEpkImpl>> leaseTokens; // epk leases
private final Map<PartitionKeyRange, List<FeedRange>> pkRangeToFeedRangeMap;
private final Map<FeedRange, ThroughputControlGroupConfig> feedRangeToThroughputControlGroupConfigMap;
private final AtomicBoolean throughputControlGroupEnabled;

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.

This class is not part of public surface area - there ould be no way to pass ThroughputControlGroup config into the ChangeFeedProcessor - to wire this up the ChangeFeedProcessorBuilder would need to accept ThroughputControlGroupConfigs - probably dedicated for monitored conatienr and another one for the lease container.

That said - I am not sure limitig throughput on lease container is really someting anyone would want to do - I would love to learn about the use case where you think you need this first before adding new public API.

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.

Thanks @FabianMeiswinkel. This PR is not adding a new public API and is not intended to limit throughput on the lease container.

The config is already passed through the existing public API:
ChangeFeedProcessorBuilder.options(new ChangeFeedProcessorOptions().setFeedPollThroughputControlConfig(...))

That option is for feed-poll requests against the monitored/feed container. This PR only changes the internal handling so that when the existing feed-poll throughput-control config includes throughputBucket, CFP enables server throughput control for that group instead of only supporting the local throughput-control path.

The use case is to isolate RU consumption from CFP feed polling on the monitored container using server-side throughput buckets. I agree that separate lease-container throughput control would need a different API/design, but that is not what this PR is trying to add.

@FabianMeiswinkel FabianMeiswinkel left a comment

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.

Teher is no way to pass ThroughputControlGroup config into the ChangeFeedProcessor with the changes in this PR - to wire this up the ChangeFeedProcessorBuilder would need to accept ThroughputControlGroupConfigs - probably dedicated for monitored conatienr and another one for the lease container.

That said - I am not sure limitig throughput on lease container is really someting anyone would want to do - I would love to learn about the use case where you think you need this first before adding new public API.

@arnabnandy7

Copy link
Copy Markdown
Contributor Author

That said - I am not sure limitig throughput on lease container is really someting anyone would want to do - I would love to learn about the use case where you think you need this first before adding new public API.

@FabianMeiswinkel Thanks for reviewing. This PR is not adding a new public API or trying to limit the lease container. It uses the existing public ChangeFeedProcessorOptions.setFeedPollThroughputControlConfig(...) API, which is passed through ChangeFeedProcessorBuilder.options(...), and applies it to CFP feed-poll requests against the monitored/feed container.

The change here is specifically that when the existing feed-poll throughput-control config includes throughputBucket, CFP enables a server throughput-control group instead of treating the config only as local throughput control.

The use case is to isolate RU consumption from CFP feed polling on the monitored container using server-side throughput buckets. I can update the wording/docs if the current implementation makes this look like lease-container throughput control.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community Contribution Community members are working on the issue Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQ]Add throughput bucket support in CFP

3 participants