Udostępnij za pośrednictwem


CosmosDatabase.ReadThroughputAsync Method

Definition

Overloads

ReadThroughputAsync(CancellationToken)

Gets database throughput in measurement of request units per second in the Azure Cosmos service.

ReadThroughputAsync(RequestOptions, CancellationToken)

Gets database throughput in measurement of request units per second in the Azure Cosmos service.

ReadThroughputAsync(CancellationToken)

Gets database throughput in measurement of request units per second in the Azure Cosmos service.

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

Parameters

cancellationToken
CancellationToken

(Optional) CancellationToken representing request cancellation.

Returns

Provisioned throughput in request units per second

Examples

The following example shows how to get database throughput.

int? throughput = await database.ReadThroughputAsync();

Remarks

Null value indicates a database with no throughput provisioned.

https://docs.microsoft.com/azure/cosmos-db/request-unitshttps://docs.microsoft.com/azure/cosmos-db/set-throughput#set-throughput-on-a-database

Applies to

ReadThroughputAsync(RequestOptions, CancellationToken)

Gets database throughput in measurement of request units per second in the Azure Cosmos service.

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

Parameters

requestOptions
RequestOptions

The options for the throughput request.RequestOptions

cancellationToken
CancellationToken

(Optional) CancellationToken representing request cancellation.

Returns

The throughput response.

Examples

The following example shows how to get the throughput

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

The following example shows how to get throughput, MinThroughput and is replace in progress

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

Remarks

Null value indicates a database with no throughput provisioned.

https://docs.microsoft.com/azure/cosmos-db/request-unitshttps://docs.microsoft.com/azure/cosmos-db/set-throughput#set-throughput-on-a-database

Applies to