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

Database.ReplaceThroughputAsync 方法

定义

重载

ReplaceThroughputAsync(ThroughputProperties, RequestOptions, CancellationToken)

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

ReplaceThroughputAsync(Int32, RequestOptions, CancellationToken)

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

ReplaceThroughputAsync(ThroughputProperties, RequestOptions, CancellationToken)

Source:
Database.cs

设置为数据库预配的吞吐量,以测量 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.cosmosDatabase.ReplaceThroughputAsync(
    ThroughputProperties.CreateManualThroughput(10000));

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

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

注解

请求单位设置数据库吞吐量

适用于

ReplaceThroughputAsync(Int32, RequestOptions, CancellationToken)

Source:
Database.cs

设置为数据库预配的吞吐量,以测量 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.cosmosDatabase.ReplaceThroughputAsync(10000);

注解

请求单位

适用于