-
Notifications
You must be signed in to change notification settings - Fork 2.1k
AddThroughputBucketSupport #46042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
AddThroughputBucketSupport #46042
Conversation
API Change CheckAPIView identified API level changes in this PR and created the following API reviews |
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/ThroughputControlGroupConfigBuilder.java
Outdated
Show resolved
Hide resolved
@@ -598,7 +598,8 @@ public enum RntbdRequestHeader implements RntbdHeader { | |||
SDKSupportedCapabilities((short) 0x00A2, RntbdTokenType.ULong, false), | |||
ChangeFeedWireFormatVersion((short) 0x00B2, RntbdTokenType.String, false), | |||
PriorityLevel((short) 0x00BF, RntbdTokenType.Byte, false), | |||
GlobalDatabaseAccountName((short) 0x00CE, RntbdTokenType.String, false); | |||
GlobalDatabaseAccountName((short) 0x00CE, RntbdTokenType.String, false), | |||
ThroughputBucket((short)0x00DB, RntbdTokenType.Byte, false); //TODO: does the throughput bucket supported in thin client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thin client is a good question. Also GAteway mode is relevant - we would rely on ComputeGateway and Routing Gateway to pass through the header. I would expect this to work in thin client because the rntbd body is passed through opaquely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will double check the behavior here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thanks for the well structured API and the great PR description - really helped to review the PR!
fa8285b
to
c965815
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces throughput bucket support to the Azure Cosmos DB Java SDK, enabling server-side throughput control functionality. The key change is adding support for throughput buckets alongside the existing priority level controls, with a new API for enabling server throughput control groups.
Key changes:
- Adds throughput bucket support to
ThroughputControlGroupConfig
and related APIs - Introduces server throughput control store and controllers for bucket-based throughput management
- Refactors existing SDK throughput control classes into a dedicated
sdk
package structure - Adds comprehensive test coverage for the new server throughput control functionality
Reviewed Changes
Copilot reviewed 80 out of 80 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
ThroughputControlGroupConfig.java |
Adds throughput bucket field and getter method |
ThroughputControlGroupConfigBuilder.java |
Adds throughput bucket setter with validation |
CosmosAsyncContainer.java |
Adds enableServerThroughputControlGroup method |
Server throughput control classes | New implementation for server-side throughput bucket control |
SDK throughput control refactor | Moves existing SDK throughput control to dedicated package |
Test files | Comprehensive test coverage for new functionality |
Comments suppressed due to low confidence (2)
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/throughputControl/sdk/ThroughputRequestThrottler.java:23
- Unused import statement should be removed. The UUID import is not used anywhere in this file.
import java.util.concurrent.ConcurrentHashMap;
...smos/implementation/throughputControl/server/controller/ServerThroughputGroupController.java
Show resolved
Hide resolved
@@ -598,7 +598,8 @@ public enum RntbdRequestHeader implements RntbdHeader { | |||
SDKSupportedCapabilities((short) 0x00A2, RntbdTokenType.ULong, false), | |||
ChangeFeedWireFormatVersion((short) 0x00B2, RntbdTokenType.String, false), | |||
PriorityLevel((short) 0x00BF, RntbdTokenType.Byte, false), | |||
GlobalDatabaseAccountName((short) 0x00CE, RntbdTokenType.String, false); | |||
GlobalDatabaseAccountName((short) 0x00CE, RntbdTokenType.String, false), | |||
ThroughputBucket((short)0x00DB, RntbdTokenType.Byte, false); //TODO: does the throughput bucket supported in thin client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TODO comment should be resolved or moved to a proper issue tracker. Comments like this should not remain in production code.
ThroughputBucket((short)0x00DB, RntbdTokenType.Byte, false); //TODO: does the throughput bucket supported in thin client | |
ThroughputBucket((short)0x00DB, RntbdTokenType.Byte, false); // Throughput bucket is supported in thin client |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will remove this comment later once confirmed the behavior
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/FullFidelityChangeFeedTest.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ClientRetryPolicyE2ETests.java
Show resolved
Hide resolved
* Get the throughput bucket. | ||
* <p> | ||
* For more information about throughput bucket please visit | ||
* <a href="https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/throughput-buckets?tabs=dotnet">Throughput buckets in Azure Cosmos DB</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doc should be extended for Java (min sdk versiona nd how to use the feature - would be better to refernece the java sample than .net - but can be done in separate PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - Thx
Description
Added throughput bucket support
Public API
Using throughput bucket only:
Using priorityLevel only:
Using priorityLevel and throughputBucket together:
UML
(Note: LocalThroughputControlGroupController & GlobalThroughputControlGroupController are removed from the graph for simplicity)
Sequence flow
Throughput control store flow:

SDK Throughput control store flow:

Server Throughput control store flow:

Diagnostics:
New requestTCG and requestTCGConfig added:

E2E testing: