Skip to content

Commit 01deb01

Browse files
committed
⚡Increase Initial Stream Window Size to reduce round trips
1 parent 8514c48 commit 01deb01

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

ModuleFast.psm1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,12 @@ function New-ModuleFastClient {
244244
Write-Debug 'Creating new ModuleFast HTTP Client. This should only happen once!'
245245
$ErrorActionPreference = 'Stop'
246246
#SocketsHttpHandler is the modern .NET 5+ default handler for HttpClient.
247-
#We want more concurrent connections to improve our performance and fairly aggressive timeouts
248-
#The max connections are only in case we end up using HTTP/1.1 instead of HTTP/2 for whatever reason.
247+
249248
$httpHandler = [SocketsHttpHandler]@{
249+
#The max connections are only in case we end up using HTTP/1.1 instead of HTTP/2 for whatever reason. HTTP/2 will only use one connection (but multiple streams) per the spec unless EnableMultipleHttp2Connections is specified
250250
MaxConnectionsPerServer = 10
251-
EnableMultipleHttp2Connections = $true
251+
#Reduce the amount of round trip confirmations by setting window size to 64MB. ModuleFast should primarily be used on reliable fast connections. Dynamic scaling will reduce this if needed.
252+
InitialHttp2StreamWindowSize = 65535000
252253
AutomaticDecompression = 'All'
253254
}
254255

@@ -659,7 +660,7 @@ function Install-ModuleFastHelper {
659660
Write-Verbose "${module}: Existing module found at $installPath and its version $existingVersion is the same as the requested version. -Update was specified so we are assuming that the discovered online version is the same as the local version and skipping this module."
660661
continue
661662
} else {
662-
throw [System.NotImplementedException]"${module}: Existing module found at $installPath and its version $existingVersion is the same as the requested version. This is probably a bug because it should have been detected by localmodule detection. Use -Update to override..."
663+
throw [NotImplementedException]"${module}: Existing module found at $installPath and its version $existingVersion is the same as the requested version. This is probably a bug because it should have been detected by localmodule detection. Use -Update to override..."
663664
}
664665
}
665666
if ($module.ModuleVersion -lt $existingVersion) {

0 commit comments

Comments
 (0)