Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
CosmosClientOptions.GatewayModeMaxConnectionLimit Property
Definition
- Namespace:
- Microsoft.Azure.Cosmos
- Assembly:
- Microsoft.Azure.Cosmos.Client.dll
- Package:
- Microsoft.Azure.Cosmos v3.58.0
- Package:
- Microsoft.Azure.Cosmos v3.59.0-preview.0
- Source:
- CosmosClientOptions.cs
Important
Some information relates to prerelease product that may be substantially modified before itβs released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Get or set the maximum number of concurrent connections allowed for the target service endpoint in the Azure Cosmos DB service.
public int GatewayModeMaxConnectionLimit { get; set; }
member this.GatewayModeMaxConnectionLimit : int with get, set
Public Property GatewayModeMaxConnectionLimit As Integer
Property Value
Default value is 50.
Examples
Using the SDK-managed handler with a custom connection limit:
CosmosClientOptions options = new CosmosClientOptions()
{
ConnectionMode = ConnectionMode.Gateway,
GatewayModeMaxConnectionLimit = 100
};
When providing a custom HttpClientFactory, set the properties on SocketsHttpHandler directly:
SocketsHttpHandler handler = new SocketsHttpHandler
{
MaxConnectionsPerServer = 100,
EnableMultipleHttp2Connections = true
};
CosmosClientOptions options = new CosmosClientOptions()
{
HttpClientFactory = () => new HttpClient(handler, disposeHandler: false)
};
Remarks
This setting is only applicable in Gateway mode. The SDK sets EnableMultipleHttp2Connections = true on the underlying SocketsHttpHandler, allowing additional HTTP/2 TCP connections to be opened when the maximum concurrent streams limit on an existing connection is reached. This property controls the upper bound on the total number of connections per server endpoint. When using a custom HttpClientFactory, set EnableMultipleHttp2Connections directly on your SocketsHttpHandler for equivalent behavior.
Applies to
See also
Azure SDK for .NET
Feedback
Was this page helpful?
