-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Increase connection pool size limit automatically (#15263)
- Loading branch information
Showing
5 changed files
with
119 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System.Net; | ||
using System.Net.Http; | ||
|
||
namespace Azure.Core.Pipeline | ||
{ | ||
internal static class ServicePointHelpers | ||
{ | ||
private const int RuntimeDefaultConnectionLimit = 2; | ||
private const int IncreasedConnectionLimit = 50; | ||
|
||
public static void SetLimits(ServicePoint requestServicePoint) | ||
{ | ||
// Only change when the default runtime limit is used | ||
if (requestServicePoint.ConnectionLimit == RuntimeDefaultConnectionLimit) | ||
{ | ||
requestServicePoint.ConnectionLimit = IncreasedConnectionLimit; | ||
} | ||
} | ||
|
||
public static void SetLimits(HttpClientHandler requestServicePoint) | ||
{ | ||
// Only change when the default runtime limit is used | ||
if (requestServicePoint.MaxConnectionsPerServer == RuntimeDefaultConnectionLimit) | ||
{ | ||
requestServicePoint.MaxConnectionsPerServer = IncreasedConnectionLimit; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters