Add throughput bucket support for Change Feed Processor feed polling#49583
Add throughput bucket support for Change Feed Processor feed polling#49583arnabnandy7 wants to merge 16 commits into
Conversation
|
Thank you for your contribution @arnabnandy7! We will review the pull request and get back to you soon. |
There was a problem hiding this comment.
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 whenthroughputBucketis set (PK-range + EPK-range paths). - Add unit tests validating server throughput control group enablement for both CFP paths when
throughputBucketis 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). |
…com:arnabnandy7/azure-sdk-for-java into feature/cfp-throughput-bucket-support_49487
| 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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
@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. |
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:
General Guidelines and Best Practices
Testing Guidelines