Autoscale throughput support
See original GitHub issueThe current design of autoscale throughput for the .NET v3 SDK.
Design:
- Union type. ThroughputProperties will contain values for both fixed and autoscale throughput. This allows a single read operation to always succeed.
- ThroughputProperties will be created through factory to ensure the correct configuration. Avoid runtime exceptions from misconfigured ThroughputProperties.
- Throughput properties will be set for both autoscale and fixed throughput offerings. MaxAutoscaleThroughput and AutoUpgradeMaxThroughputIncrementPercentage will only be populated if autoscale is set.
Database database = await this.cosmosClient.CreateDatabaseAsync(
nameof(CreateDropAutoscaleDatabase) + Guid.NewGuid().ToString(),
ThroughputProperties.CreateAutoScaleProvionedThroughput(5000));
ThroughputResponse autoscale = await database.ReadThroughputAsync(requestOptions: null);
Assert.IsNotNull(autoscale);
Assert.AreEqual(5000, autoscale.Resource.MaxAutoscaleThroughput);
ThroughputResponse autoscaleReplaced = await database.ReplaceThroughputPropertiesAsync(
ThroughputProperties.CreateAutoScaleProvionedThroughput(10000));
Assert.IsNotNull(autoscaleReplaced);
Assert.AreEqual(10000, autoscaleReplaced.Resource.MaxAutoscaleThroughput);
Container container = await database.CreateContainerAsync(
new ContainerProperties(Guid.NewGuid().ToString(), "/pk"),
ThroughputProperties.CreateAutoScaleProvionedThroughput(5000));
ThroughputResponse autoscale = await container.ReadThroughputAsync(requestOptions: null);
Assert.IsNotNull(autoscale);
Assert.AreEqual(5000, autoscale.Resource.MaxAutoscaleThroughput);
ThroughputResponse autoscaleIfExists = await container.ReadThroughputIfExistsAsync(requestOptions: null);
Assert.IsNotNull(autoscaleIfExists);
Assert.AreEqual(5000, autoscaleIfExists.Resource.MaxAutoscaleThroughput);
ThroughputResponse autoscaleReplaced = await container.ReplaceThroughputPropertiesAsync(
ThroughputProperties.CreateAutoScaleProvionedThroughput(10000));
Assert.IsNotNull(autoscaleReplaced);
Assert.AreEqual(10000, autoscaleReplaced.Resource.MaxAutoscaleThroughput);
public class ThroughputProperties
{
[JsonConstructor]
private ThroughputProperties()
{
}
[JsonProperty(PropertyName = Constants.Properties.ETag, NullValueHandling = NullValueHandling.Ignore)]
public string ETag { get; private set; }
[JsonConverter(typeof(UnixDateTimeConverter))]
[JsonProperty(PropertyName = Constants.Properties.LastModified, NullValueHandling = NullValueHandling.Ignore)]
public DateTime? LastModified { get; private set; }
[JsonIgnore]
public int? Throughput { get; private set; }
[JsonIgnore]
public int? MaxAutoscaleThroughput {get;}
public static ThroughputProperties CreateFixedThroughput(int throughput)
{
return;
}
public static ThroughputProperties CreateAutoscaleProvionedThroughput(
int maxAutoscaleThroughput)
{
return;
}
[JsonProperty(PropertyName = Constants.Properties.SelfLink, NullValueHandling = NullValueHandling.Ignore)]
public string SelfLink { get; private set; }
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:27 (13 by maintainers)
Top Results From Across the Web
Create Azure Cosmos DB containers and databases in ...
In Azure Cosmos DB, you can configure either standard (manual) or autoscale provisioned throughput on your databases and containers.
Read more >Frequently asked questions about autoscale provisioned ...
Is autoscale supported for shared throughput databases? Yes. To enable autoscale for a shared throughput database, when you create the database, select ...
Read more >Understanding Autoscale Throughput in Azure Cosmos DB
Creating a container with Autoscale Throughput provisioned. To follow along with this article, it would help to be familiar with Azure ...
Read more >Throughput autoscaling: Dynamic sizing for Facebook.com
Throughput autoscaling makes sizing decisions based on the amount of work that the service needs to perform as measured by throughput metrics.
Read more >How DynamoDB auto scaling works
Amazon DynamoDB auto scaling uses the AWS Application Auto Scaling service to dynamically adjust provisioned throughput capacity on your behalf, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jahmai the autoscale offer resource that the service is creating from preview sdk is slightly different from the offer that portal will create for autoscale container today for the same autoscale max throughput. Portal doesn’t understand this difference yet and that’s why it is not showing a way to change max throughput or switch back to manual(not because it thinks this container has been configured with manual throughput and there is no way to make this autoscale today) If you see a banner that asks you to refresh the browser cache under “scale and settings” tab in portal that’s an indication that collection is autoscale enabled and was created using the preview sdk. As @j82w mentioned portal experience will get updated early this week.
In that case - how about we go with supporting the create new scenario for now, and add the conversion based on feedback later?