你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Container.ReplaceThroughputAsync 方法

定义

重载

ReplaceThroughputAsync(ThroughputProperties, RequestOptions, CancellationToken)

设置为容器预配的吞吐量,以测量 Azure Cosmos 服务中的每秒请求单位数。

ReplaceThroughputAsync(Int32, RequestOptions, CancellationToken)

设置为容器预配的吞吐量,以测量 Azure Cosmos 服务中的每秒请求单位数。

ReplaceThroughputAsync(ThroughputProperties, RequestOptions, CancellationToken)

设置为容器预配的吞吐量,以测量 Azure Cosmos 服务中的每秒请求单位数。

public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ThroughputResponse> ReplaceThroughputAsync (Microsoft.Azure.Cosmos.ThroughputProperties throughputProperties, Microsoft.Azure.Cosmos.RequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member ReplaceThroughputAsync : Microsoft.Azure.Cosmos.ThroughputProperties * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ThroughputResponse>
Public MustOverride Function ReplaceThroughputAsync (throughputProperties As ThroughputProperties, Optional requestOptions As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ThroughputResponse)

参数

throughputProperties
ThroughputProperties

Cosmos 容器吞吐量以每秒请求单位表示。

requestOptions
RequestOptions

(可选) 吞吐量请求的选项。

cancellationToken
CancellationToken

(表示请求取消的可选) CancellationToken

返回

吞吐量响应。

示例

以下示例演示如何替换固定吞吐量。

ThroughputResponse throughput = await this.cosmosContainer.ReplaceThroughputAsync(
    ThroughputProperties.CreateManualThroughput(10000));

以下示例演示如何替换自动缩放预配的吞吐量

ThroughputResponse throughput = await this.cosmosContainer.ReplaceThroughputAsync(
    ThroughputProperties.CreateAutoscaleThroughput(10000));

注解

请求单位设置容器的吞吐量

适用于

ReplaceThroughputAsync(Int32, RequestOptions, CancellationToken)

设置为容器预配的吞吐量,以测量 Azure Cosmos 服务中的每秒请求单位数。

public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ThroughputResponse> ReplaceThroughputAsync (int throughput, Microsoft.Azure.Cosmos.RequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member ReplaceThroughputAsync : int * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ThroughputResponse>
Public MustOverride Function ReplaceThroughputAsync (throughput As Integer, Optional requestOptions As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ThroughputResponse)

参数

throughput
Int32

Cosmos 容器吞吐量,以每秒请求单位表示。

requestOptions
RequestOptions

(可选) 吞吐量请求的选项。

cancellationToken
CancellationToken

(表示请求取消的可选) CancellationToken

返回

吞吐量响应。

示例

以下示例演示如何获取吞吐量。

ThroughputResponse throughput = await this.cosmosContainer.ReplaceThroughputAsync(400);

注解

https://docs.microsoft.com/azure/cosmos-db/request-units 有关预配吞吐量的详细信息。

适用于