Azure CosmosDB AutoScaling Using Code/Automation



是否可以使用 c# 或 Azure 自动化自动缩放 CosmosDB 吞吐量?请提供一个示例。

存储会自动扩展。这是自动更改吞吐量的代码

//Fetch the resource to be updated
Offer offer = client.CreateOfferQuery()
                  .Where(r => r.ResourceLink == collection.SelfLink)    
                  .AsEnumerable()
                  .SingleOrDefault();
// Set the throughput to 2500 request units per second
offer = new OfferV2(offer, 2500);
//Now persist these changes to the database by replacing the original resource
await client.ReplaceOfferAsync(offer);

在此处查看更多内容: https://learn.microsoft.com/en-us/azure/cosmos-db/set-throughput

最新更新