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

Container.ReadThroughputAsync 方法

定义

重载

ReadThroughputAsync(CancellationToken)

获取容器吞吐量,以度量 Azure Cosmos 服务中的每秒请求单位数。

ReadThroughputAsync(RequestOptions, CancellationToken)

获取容器吞吐量,以度量 Azure Cosmos 服务中的每秒请求单位数。

ReadThroughputAsync(CancellationToken)

获取容器吞吐量,以度量 Azure Cosmos 服务中的每秒请求单位数。

public abstract System.Threading.Tasks.Task<int?> ReadThroughputAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member ReadThroughputAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<Nullable<int>>
Public MustOverride Function ReadThroughputAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of Nullable(Of Integer))

参数

cancellationToken
CancellationToken

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

返回

预配吞吐量(以每秒请求单位为单位)

示例

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

int? throughput = await container.ReadThroughputAsync();

注解

Null 值表示未预配吞吐量的容器。

适用于

ReadThroughputAsync(RequestOptions, CancellationToken)

获取容器吞吐量,以度量 Azure Cosmos 服务中的每秒请求单位数。

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

参数

requestOptions
RequestOptions

吞吐量请求的选项。

cancellationToken
CancellationToken

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

返回

吞吐量响应

示例

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

RequestOptions requestOptions = new RequestOptions();
ThroughputProperties throughputProperties = await container.ReadThroughputAsync(requestOptions);
Console.WriteLine($"Throughput: {throughputProperties?.Throughput}");

以下示例演示如何获取吞吐量 MinThroughput,并正在替换

RequestOptions requestOptions = new RequestOptions();
ThroughputResponse response = await container.ReadThroughputAsync(requestOptions);
Console.WriteLine($"Throughput: {response.Resource?.Throughput}");
Console.WriteLine($"MinThroughput: {response.MinThroughput}");
Console.WriteLine($"IsReplacePending: {response.IsReplacePending}");

注解

有关预配产品/服务吞吐量的详细信息, http://azure.microsoft.com/documentation/articles/documentdb-performance-levels/ 请参阅 。

适用于