question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autoscale throughput support

See original GitHub issue

The current design of autoscale throughput for the .NET v3 SDK.

Design:

  1. Union type. ThroughputProperties will contain values for both fixed and autoscale throughput. This allows a single read operation to always succeed.
  2. ThroughputProperties will be created through factory to ensure the correct configuration. Avoid runtime exceptions from misconfigured ThroughputProperties.
  3. 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:27 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
ravgillcommented, Apr 26, 2020

@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.

1reaction
deborahccommented, Apr 15, 2020

In that case - how about we go with supporting the create new scenario for now, and add the conversion based on feedback later?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found