-
Notifications
You must be signed in to change notification settings - Fork 252
Config Max Http Request In NuGet
https://github.com/NuGet/Home/issues/4538
Today, NuGet has no consistent story about the number of parallel HTTP requests allowed.
In our Visual Studio extension or NuGet.exe/Dotnet CLI on non-mac OS, there is no http request throttling for package dependency resolving. We end up sending hundreds requests at the same time, restore times out due to default connection limit is 2.
Any customer who do restore with limited network resource like on docker, mono..etc.
We have a NetworkProtocolUtility.SetConnectionLimit
API, but this only works on .NET Framework and sets the value to 64 on non-Mono environments (Mono is set to 1). This API is not called in VS (and should not until we know how it would effect other components in the VS process and if it's even the right solution).
HttpSource
has an IThrottle
parameter which allows controlling the total number of pending HTTP requests. This is used for --disable-parallel
by implementing IThrottle
with a semaphore of size 1.
Package.config use maxDegreeOfParallelism which is set to Environment.ProcessorCount by default for dependency fetching and package download & extraction
PackageReference throttling in SourceRepositoryDependencyProvider only on mac for dependency resolving and use MaxDegreeOfConcurrency for package download and extraction. The default value for both are 16
We should provide a way to control the max http request from NuGet.Config.
<config>
<add key="maxHttpRequest" value="16" />
</config>
This setting can control all http request number sending from nuget for package dependency resolving and package downloading.
-
Do we need a default value for this setting on non-mac scenario? We don't have any throttling on that now, since throttling hurts performance.
-
Do we still keep high level throttling like throttling in NuGetPackageManager/SourceReposiotryDependencyProvider after we have this low level throttling on httpClient?
Check out the proposals in the accepted
& proposed
folders on the repository, and active PRs for proposals being discussed today.