Skip to content

Commit 27ce4ed

Browse files
ealsurPilchie
andauthored
Update articles/cosmos-db/nosql/best-practice-dotnet.md
Co-authored-by: Kevin Pilch <[email protected]>
1 parent c3e4332 commit 27ce4ed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

articles/cosmos-db/nosql/best-practice-dotnet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Watch the video below to learn more about using the .NET SDK from an Azure Cosmo
5353

5454
## Best practices for HTTP connections
5555

56-
The .NET SDK uses `HttpClient` to perform HTTP operations both data plane for Gateway mode and [metadata for Direct mode](sdk-connection-modes.md#direct-mode). One of the [fundamentals of HttpClient](/dotnet/fundamentals/networking/http/httpclient-guidelines#dns-behavior) is to make sure the `HttpClient` can react to DNS changes on your account by **customizing the DNS cache timeout**. When the DNS cache is cleared, **connections are closed**. Our recommendation is that you customize this value according to your [connectivity mode](sdk-connection-modes.md) and workload to reduce potential impact of the DNS cache refresh to a minimum (a 5 minute value would be a good start for Direct mode clients).
56+
The .NET SDK uses `HttpClient` to perform HTTP operations for both data plane for Gateway mode and [metadata for Direct mode](sdk-connection-modes.md#direct-mode). One of the [fundamentals of HttpClient](/dotnet/fundamentals/networking/http/httpclient-guidelines#dns-behavior) is to make sure the `HttpClient` can react to DNS changes on your account by **customizing the pooled connection lifetime**. As long as pooled connections are kept open, they do not react to DNS changes. This setting forces pooled **connections to be closed** periodically, ensuring that your application reacts to DNS changes. Our recommendation is that you customize this value according to your [connectivity mode](sdk-connection-modes.md) and workload to balance the performance impact of frequently creating new connections, with needing to react to DNS changes (a 5 minute value would be a good start for Direct mode clients).
5757

5858
You can inject your custom HttpClient through `CosmosClientOptions.HttpClientFactory`, for example:
5959

0 commit comments

Comments
 (0)