Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP/2 - Large download speed is dramatically slower than HTTP/1.1 #47092

Closed
EatonZ opened this issue Jan 17, 2021 · 5 comments
Closed

HTTP/2 - Large download speed is dramatically slower than HTTP/1.1 #47092

EatonZ opened this issue Jan 17, 2021 · 5 comments
Labels
Milestone

Comments

@EatonZ
Copy link
Contributor

EatonZ commented Jan 17, 2021

Description

When downloading a large (100 MB) file via a HttpClient configured for HTTP/2, the download speed is a fraction of HTTP/1.1 speeds.

Configuration

My network speed: 250 mbps (both ways, fiber)

Benchmark code. It is configured for HTTP/2. To configure for HTTP/1.1, replace RequestVersionOrHigher with RequestVersionOrLower.

[MemoryDiagnoser]
public class BenchmarkClass
{
    //EnableMultipleHttp2Connections is probably unnecessary, but might as well enable it.
    private readonly HttpClient httpClient = new(new SocketsHttpHandler { EnableMultipleHttp2Connections = true }) { DefaultRequestVersion = HttpVersion.Version11, DefaultVersionPolicy = HttpVersionPolicy.RequestVersionOrHigher };

    [Benchmark]
    public async Task Execute() => await httpClient.GetByteArrayAsync("https://fl-us-ping.vultr.com/vultr.com.100MB.bin");
}

Data

HTTP/1.1 benchmark test:

// BeforeAnythingElse

// Benchmark Process Environment Information:
// Runtime=.NET Core 5.0.2 (CoreCLR 5.0.220.61120, CoreFX 5.0.220.61120), X64 RyuJIT
// GC=Concurrent Workstation
// Job: DefaultJob

OverheadJitting  1: 1 op, 155300.00 ns, 155.3000 us/op
WorkloadJitting  1: 1 op, 5162540000.00 ns, 5.1625 s/op

WorkloadWarmup   1: 1 op, 4688713200.00 ns, 4.6887 s/op
WorkloadWarmup   2: 1 op, 4791019900.00 ns, 4.7910 s/op
WorkloadWarmup   3: 1 op, 4762101400.00 ns, 4.7621 s/op
WorkloadWarmup   4: 1 op, 4905291500.00 ns, 4.9053 s/op
WorkloadWarmup   5: 1 op, 4981192100.00 ns, 4.9812 s/op
WorkloadWarmup   6: 1 op, 4897533000.00 ns, 4.8975 s/op

// BeforeActualRun
WorkloadActual   1: 1 op, 5169031400.00 ns, 5.1690 s/op
WorkloadActual   2: 1 op, 4802047400.00 ns, 4.8020 s/op
WorkloadActual   3: 1 op, 5088965000.00 ns, 5.0890 s/op
WorkloadActual   4: 1 op, 4936325600.00 ns, 4.9363 s/op
WorkloadActual   5: 1 op, 4980631400.00 ns, 4.9806 s/op
WorkloadActual   6: 1 op, 4762417600.00 ns, 4.7624 s/op
WorkloadActual   7: 1 op, 4822597700.00 ns, 4.8226 s/op
WorkloadActual   8: 1 op, 4987580400.00 ns, 4.9876 s/op
WorkloadActual   9: 1 op, 4775483100.00 ns, 4.7755 s/op
WorkloadActual  10: 1 op, 4989825800.00 ns, 4.9898 s/op
WorkloadActual  11: 1 op, 5192689700.00 ns, 5.1927 s/op
WorkloadActual  12: 1 op, 5080018600.00 ns, 5.0800 s/op
WorkloadActual  13: 1 op, 5016504700.00 ns, 5.0165 s/op
WorkloadActual  14: 1 op, 4806887800.00 ns, 4.8069 s/op
WorkloadActual  15: 1 op, 4736753000.00 ns, 4.7368 s/op
WorkloadActual  16: 1 op, 5184585300.00 ns, 5.1846 s/op
WorkloadActual  17: 1 op, 5219811200.00 ns, 5.2198 s/op
WorkloadActual  18: 1 op, 4834304800.00 ns, 4.8343 s/op
WorkloadActual  19: 1 op, 4787100400.00 ns, 4.7871 s/op
WorkloadActual  20: 1 op, 4679289100.00 ns, 4.6793 s/op
WorkloadActual  21: 1 op, 4830461200.00 ns, 4.8305 s/op
WorkloadActual  22: 1 op, 4636933400.00 ns, 4.6369 s/op
WorkloadActual  23: 1 op, 4706413600.00 ns, 4.7064 s/op
WorkloadActual  24: 1 op, 4972635200.00 ns, 4.9726 s/op
WorkloadActual  25: 1 op, 4521055700.00 ns, 4.5211 s/op
WorkloadActual  26: 1 op, 4887251400.00 ns, 4.8873 s/op
WorkloadActual  27: 1 op, 4873791300.00 ns, 4.8738 s/op
WorkloadActual  28: 1 op, 4839775000.00 ns, 4.8398 s/op
WorkloadActual  29: 1 op, 5198689300.00 ns, 5.1987 s/op
WorkloadActual  30: 1 op, 4858600000.00 ns, 4.8586 s/op
WorkloadActual  31: 1 op, 5046287000.00 ns, 5.0463 s/op
WorkloadActual  32: 1 op, 4670018300.00 ns, 4.6700 s/op
WorkloadActual  33: 1 op, 4931828400.00 ns, 4.9318 s/op
WorkloadActual  34: 1 op, 4664491500.00 ns, 4.6645 s/op
WorkloadActual  35: 1 op, 4961895500.00 ns, 4.9619 s/op
WorkloadActual  36: 1 op, 4756443300.00 ns, 4.7564 s/op
WorkloadActual  37: 1 op, 4699424600.00 ns, 4.6994 s/op
WorkloadActual  38: 1 op, 4777705700.00 ns, 4.7777 s/op
WorkloadActual  39: 1 op, 4751986700.00 ns, 4.7520 s/op
WorkloadActual  40: 1 op, 5026981900.00 ns, 5.0270 s/op
WorkloadActual  41: 1 op, 4829563900.00 ns, 4.8296 s/op

// AfterActualRun
WorkloadResult   1: 1 op, 5169031400.00 ns, 5.1690 s/op
WorkloadResult   2: 1 op, 4802047400.00 ns, 4.8020 s/op
WorkloadResult   3: 1 op, 5088965000.00 ns, 5.0890 s/op
WorkloadResult   4: 1 op, 4936325600.00 ns, 4.9363 s/op
WorkloadResult   5: 1 op, 4980631400.00 ns, 4.9806 s/op
WorkloadResult   6: 1 op, 4762417600.00 ns, 4.7624 s/op
WorkloadResult   7: 1 op, 4822597700.00 ns, 4.8226 s/op
WorkloadResult   8: 1 op, 4987580400.00 ns, 4.9876 s/op
WorkloadResult   9: 1 op, 4775483100.00 ns, 4.7755 s/op
WorkloadResult  10: 1 op, 4989825800.00 ns, 4.9898 s/op
WorkloadResult  11: 1 op, 5192689700.00 ns, 5.1927 s/op
WorkloadResult  12: 1 op, 5080018600.00 ns, 5.0800 s/op
WorkloadResult  13: 1 op, 5016504700.00 ns, 5.0165 s/op
WorkloadResult  14: 1 op, 4806887800.00 ns, 4.8069 s/op
WorkloadResult  15: 1 op, 4736753000.00 ns, 4.7368 s/op
WorkloadResult  16: 1 op, 5184585300.00 ns, 5.1846 s/op
WorkloadResult  17: 1 op, 5219811200.00 ns, 5.2198 s/op
WorkloadResult  18: 1 op, 4834304800.00 ns, 4.8343 s/op
WorkloadResult  19: 1 op, 4787100400.00 ns, 4.7871 s/op
WorkloadResult  20: 1 op, 4679289100.00 ns, 4.6793 s/op
WorkloadResult  21: 1 op, 4830461200.00 ns, 4.8305 s/op
WorkloadResult  22: 1 op, 4636933400.00 ns, 4.6369 s/op
WorkloadResult  23: 1 op, 4706413600.00 ns, 4.7064 s/op
WorkloadResult  24: 1 op, 4972635200.00 ns, 4.9726 s/op
WorkloadResult  25: 1 op, 4521055700.00 ns, 4.5211 s/op
WorkloadResult  26: 1 op, 4887251400.00 ns, 4.8873 s/op
WorkloadResult  27: 1 op, 4873791300.00 ns, 4.8738 s/op
WorkloadResult  28: 1 op, 4839775000.00 ns, 4.8398 s/op
WorkloadResult  29: 1 op, 5198689300.00 ns, 5.1987 s/op
WorkloadResult  30: 1 op, 4858600000.00 ns, 4.8586 s/op
WorkloadResult  31: 1 op, 5046287000.00 ns, 5.0463 s/op
WorkloadResult  32: 1 op, 4670018300.00 ns, 4.6700 s/op
WorkloadResult  33: 1 op, 4931828400.00 ns, 4.9318 s/op
WorkloadResult  34: 1 op, 4664491500.00 ns, 4.6645 s/op
WorkloadResult  35: 1 op, 4961895500.00 ns, 4.9619 s/op
WorkloadResult  36: 1 op, 4756443300.00 ns, 4.7564 s/op
WorkloadResult  37: 1 op, 4699424600.00 ns, 4.6994 s/op
WorkloadResult  38: 1 op, 4777705700.00 ns, 4.7777 s/op
WorkloadResult  39: 1 op, 4751986700.00 ns, 4.7520 s/op
WorkloadResult  40: 1 op, 5026981900.00 ns, 5.0270 s/op
WorkloadResult  41: 1 op, 4829563900.00 ns, 4.8296 s/op
GC:  0 0 0 106004328 1
Threading:  2445 0 1

// AfterAll
// Benchmark Process 29668 has exited with code 0

Mean = 4.885 s, StdErr = 0.027 s (0.55%), N = 41, StdDev = 0.173 s
Min = 4.521 s, Q1 = 4.762 s, Median = 4.840 s, Q3 = 4.990 s, Max = 5.220 s
IQR = 0.227 s, LowerFence = 4.421 s, UpperFence = 5.331 s
ConfidenceInterval = [4.789 s; 4.981 s] (CI 99.9%), Margin = 0.096 s (1.96% of Mean)
Skewness = 0.26, Kurtosis = 2.24, MValue = 2

// ***** BenchmarkRunner: Finish  *****

// * Export *
  BenchmarkDotNet.Artifacts\results\Benchmark.BenchmarkClass-report.csv
  BenchmarkDotNet.Artifacts\results\Benchmark.BenchmarkClass-report-github.md
  BenchmarkDotNet.Artifacts\results\Benchmark.BenchmarkClass-report.html

// * Detailed results *
BenchmarkClass.Execute: DefaultJob
Runtime = .NET Core 5.0.2 (CoreCLR 5.0.220.61120, CoreFX 5.0.220.61120), X64 RyuJIT; GC = Concurrent Workstation
Mean = 4.885 s, StdErr = 0.027 s (0.55%), N = 41, StdDev = 0.173 s
Min = 4.521 s, Q1 = 4.762 s, Median = 4.840 s, Q3 = 4.990 s, Max = 5.220 s
IQR = 0.227 s, LowerFence = 4.421 s, UpperFence = 5.331 s
ConfidenceInterval = [4.789 s; 4.981 s] (CI 99.9%), Margin = 0.096 s (1.96% of Mean)
Skewness = 0.26, Kurtosis = 2.24, MValue = 2
-------------------- Histogram --------------------
[4.455 s ; 4.587 s) | @
[4.587 s ; 4.747 s) | @@@@@@@
[4.747 s ; 4.923 s) | @@@@@@@@@@@@@@@@
[4.923 s ; 5.055 s) | @@@@@@@@@@
[5.055 s ; 5.286 s) | @@@@@@@
---------------------------------------------------

// * Summary *

BenchmarkDotNet=v0.12.1, OS=Windows 10.0.18363.959 (1909/November2018Update/19H2)
Intel Core i7-6700K CPU 4.00GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=5.0.102
  [Host]     : .NET Core 5.0.2 (CoreCLR 5.0.220.61120, CoreFX 5.0.220.61120), X64 RyuJIT
  DefaultJob : .NET Core 5.0.2 (CoreCLR 5.0.220.61120, CoreFX 5.0.220.61120), X64 RyuJIT


|  Method |    Mean |    Error |   StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|-------- |--------:|---------:|---------:|------:|------:|------:|----------:|
| Execute | 4.885 s | 0.0960 s | 0.1731 s |     - |     - |     - | 101.09 MB |

// * Legends *
  Mean      : Arithmetic mean of all measurements
  Error     : Half of 99.9% confidence interval
  StdDev    : Standard deviation of all measurements
  Gen 0     : GC Generation 0 collects per 1000 operations
  Gen 1     : GC Generation 1 collects per 1000 operations
  Gen 2     : GC Generation 2 collects per 1000 operations
  Allocated : Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)
  1 s       : 1 Second (1 sec)

// * Diagnostic Output - MemoryDiagnoser *


// ***** BenchmarkRunner: End *****
// ** Remained 0 benchmark(s) to run **
Run time: 00:04:00 (240.32 sec), executed benchmarks: 1

Global total time: 00:04:03 (243.8 sec), executed benchmarks: 1
// * Artifacts cleanup *

HTTP/2 benchmark test:

// BeforeAnythingElse

// Benchmark Process Environment Information:
// Runtime=.NET Core 5.0.2 (CoreCLR 5.0.220.61120, CoreFX 5.0.220.61120), X64 RyuJIT
// GC=Concurrent Workstation
// Job: DefaultJob

OverheadJitting  1: 1 op, 164200.00 ns, 164.2000 us/op
WorkloadJitting  1: 1 op, 29204792100.00 ns, 29.2048 s/op

WorkloadWarmup   1: 1 op, 29576980600.00 ns, 29.5770 s/op
WorkloadWarmup   2: 1 op, 26469932000.00 ns, 26.4699 s/op
WorkloadWarmup   3: 1 op, 27514975600.00 ns, 27.5150 s/op
WorkloadWarmup   4: 1 op, 28614916900.00 ns, 28.6149 s/op
WorkloadWarmup   5: 1 op, 28301241700.00 ns, 28.3012 s/op
WorkloadWarmup   6: 1 op, 24512659500.00 ns, 24.5127 s/op
WorkloadWarmup   7: 1 op, 30254852700.00 ns, 30.2549 s/op
WorkloadWarmup   8: 1 op, 26094880000.00 ns, 26.0949 s/op

// BeforeActualRun
WorkloadActual   1: 1 op, 32264387500.00 ns, 32.2644 s/op
WorkloadActual   2: 1 op, 25472289500.00 ns, 25.4723 s/op
WorkloadActual   3: 1 op, 28781951500.00 ns, 28.7820 s/op
WorkloadActual   4: 1 op, 28742581200.00 ns, 28.7426 s/op
WorkloadActual   5: 1 op, 30525960600.00 ns, 30.5260 s/op
WorkloadActual   6: 1 op, 28687627100.00 ns, 28.6876 s/op
WorkloadActual   7: 1 op, 35565412700.00 ns, 35.5654 s/op
WorkloadActual   8: 1 op, 32085104500.00 ns, 32.0851 s/op
WorkloadActual   9: 1 op, 34693116000.00 ns, 34.6931 s/op
WorkloadActual  10: 1 op, 32895600800.00 ns, 32.8956 s/op
WorkloadActual  11: 1 op, 27170791200.00 ns, 27.1708 s/op
WorkloadActual  12: 1 op, 26036678600.00 ns, 26.0367 s/op
WorkloadActual  13: 1 op, 29733935000.00 ns, 29.7339 s/op
WorkloadActual  14: 1 op, 25973529900.00 ns, 25.9735 s/op
WorkloadActual  15: 1 op, 27827091500.00 ns, 27.8271 s/op
WorkloadActual  16: 1 op, 27078766400.00 ns, 27.0788 s/op
WorkloadActual  17: 1 op, 26445929900.00 ns, 26.4459 s/op
WorkloadActual  18: 1 op, 29992976800.00 ns, 29.9930 s/op
WorkloadActual  19: 1 op, 28476811500.00 ns, 28.4768 s/op
WorkloadActual  20: 1 op, 32386656400.00 ns, 32.3867 s/op
WorkloadActual  21: 1 op, 28369239300.00 ns, 28.3692 s/op
WorkloadActual  22: 1 op, 26689712300.00 ns, 26.6897 s/op
WorkloadActual  23: 1 op, 28178685100.00 ns, 28.1787 s/op
WorkloadActual  24: 1 op, 28012557500.00 ns, 28.0126 s/op
WorkloadActual  25: 1 op, 31708776800.00 ns, 31.7088 s/op
WorkloadActual  26: 1 op, 34023858000.00 ns, 34.0239 s/op
WorkloadActual  27: 1 op, 30338892700.00 ns, 30.3389 s/op
WorkloadActual  28: 1 op, 29947852500.00 ns, 29.9479 s/op
WorkloadActual  29: 1 op, 32422993900.00 ns, 32.4230 s/op
WorkloadActual  30: 1 op, 28607864900.00 ns, 28.6079 s/op
WorkloadActual  31: 1 op, 28978476800.00 ns, 28.9785 s/op
WorkloadActual  32: 1 op, 31813635600.00 ns, 31.8136 s/op
WorkloadActual  33: 1 op, 30845827600.00 ns, 30.8458 s/op
WorkloadActual  34: 1 op, 26904340100.00 ns, 26.9043 s/op
WorkloadActual  35: 1 op, 29548184200.00 ns, 29.5482 s/op
WorkloadActual  36: 1 op, 33371009900.00 ns, 33.3710 s/op
WorkloadActual  37: 1 op, 29699550300.00 ns, 29.6996 s/op
WorkloadActual  38: 1 op, 25937753400.00 ns, 25.9378 s/op
WorkloadActual  39: 1 op, 30245911600.00 ns, 30.2459 s/op
WorkloadActual  40: 1 op, 30080595200.00 ns, 30.0806 s/op
WorkloadActual  41: 1 op, 25874589000.00 ns, 25.8746 s/op
WorkloadActual  42: 1 op, 31486464200.00 ns, 31.4865 s/op
WorkloadActual  43: 1 op, 27357412000.00 ns, 27.3574 s/op
WorkloadActual  44: 1 op, 30406149500.00 ns, 30.4061 s/op
WorkloadActual  45: 1 op, 29387948200.00 ns, 29.3879 s/op
WorkloadActual  46: 1 op, 24711794200.00 ns, 24.7118 s/op
WorkloadActual  47: 1 op, 25297962600.00 ns, 25.2980 s/op
WorkloadActual  48: 1 op, 31596880800.00 ns, 31.5969 s/op
WorkloadActual  49: 1 op, 27569116000.00 ns, 27.5691 s/op
WorkloadActual  50: 1 op, 26746015600.00 ns, 26.7460 s/op
WorkloadActual  51: 1 op, 27112120400.00 ns, 27.1121 s/op
WorkloadActual  52: 1 op, 26595454900.00 ns, 26.5955 s/op
WorkloadActual  53: 1 op, 27378460400.00 ns, 27.3785 s/op
WorkloadActual  54: 1 op, 26179511500.00 ns, 26.1795 s/op
WorkloadActual  55: 1 op, 26111812200.00 ns, 26.1118 s/op
WorkloadActual  56: 1 op, 31314994600.00 ns, 31.3150 s/op
WorkloadActual  57: 1 op, 27607733300.00 ns, 27.6077 s/op
WorkloadActual  58: 1 op, 27183957200.00 ns, 27.1840 s/op
WorkloadActual  59: 1 op, 28024470300.00 ns, 28.0245 s/op
WorkloadActual  60: 1 op, 30482891500.00 ns, 30.4829 s/op
WorkloadActual  61: 1 op, 30335580200.00 ns, 30.3356 s/op
WorkloadActual  62: 1 op, 27522602600.00 ns, 27.5226 s/op
WorkloadActual  63: 1 op, 24675288100.00 ns, 24.6753 s/op
WorkloadActual  64: 1 op, 32481784700.00 ns, 32.4818 s/op
WorkloadActual  65: 1 op, 28030212600.00 ns, 28.0302 s/op
WorkloadActual  66: 1 op, 32863265900.00 ns, 32.8633 s/op
WorkloadActual  67: 1 op, 26549489800.00 ns, 26.5495 s/op
WorkloadActual  68: 1 op, 29509954600.00 ns, 29.5100 s/op
WorkloadActual  69: 1 op, 37809682100.00 ns, 37.8097 s/op
WorkloadActual  70: 1 op, 30245426600.00 ns, 30.2454 s/op
WorkloadActual  71: 1 op, 27226532000.00 ns, 27.2265 s/op
WorkloadActual  72: 1 op, 32323673600.00 ns, 32.3237 s/op
WorkloadActual  73: 1 op, 26401358400.00 ns, 26.4014 s/op
WorkloadActual  74: 1 op, 29659517100.00 ns, 29.6595 s/op
WorkloadActual  75: 1 op, 27671457800.00 ns, 27.6715 s/op
WorkloadActual  76: 1 op, 28240115300.00 ns, 28.2401 s/op
WorkloadActual  77: 1 op, 29547425000.00 ns, 29.5474 s/op
WorkloadActual  78: 1 op, 29190261600.00 ns, 29.1903 s/op
WorkloadActual  79: 1 op, 31314600100.00 ns, 31.3146 s/op
WorkloadActual  80: 1 op, 27145792000.00 ns, 27.1458 s/op
WorkloadActual  81: 1 op, 28460064500.00 ns, 28.4601 s/op

Stopped here because it was taking way too long. You should get the idea based on the numbers shown above.

Analysis

What I have tried:

  • VPN to try and rule out anything ISP-related on my end.
  • Different web servers to ensure they aren't the bottleneck.

Neither made any noteworthy difference.

Another person appears to have this problem too.

Also some good information in this answer.

Could .NET be better-optimized for large HTTP/2 downloads? The performance difference surprised me. I'd love to see other peoples' benchmark results.

@EatonZ EatonZ added the tenet-performance Performance related issue label Jan 17, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Net.Http untriaged New issue has not been triaged by the area owner labels Jan 17, 2021
@ghost
Copy link

ghost commented Jan 17, 2021

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

When downloading a large (100 MB) file via a HttpClient configured for HTTP/2, the download speed is a fraction of HTTP/1.1 speeds.

Configuration

My network speed: 250 mbps (both ways, fiber)

Benchmark code. It is configured for HTTP/2. To configure for HTTP/1.1, replace RequestVersionOrHigher with RequestVersionOrLower.

[MemoryDiagnoser]
public class BenchmarkClass
{
    //EnableMultipleHttp2Connections is probably unnecessary, but might as well enable it.
    private readonly HttpClient httpClient = new(new SocketsHttpHandler { EnableMultipleHttp2Connections = true }) { DefaultRequestVersion = HttpVersion.Version11, DefaultVersionPolicy = HttpVersionPolicy.RequestVersionOrHigher };

    [Benchmark]
    public async Task Execute() => await httpClient.GetByteArrayAsync("https://fl-us-ping.vultr.com/vultr.com.100MB.bin");
}

Data

HTTP/1.1 benchmark test:

// BeforeAnythingElse

// Benchmark Process Environment Information:
// Runtime=.NET Core 5.0.2 (CoreCLR 5.0.220.61120, CoreFX 5.0.220.61120), X64 RyuJIT
// GC=Concurrent Workstation
// Job: DefaultJob

OverheadJitting  1: 1 op, 155300.00 ns, 155.3000 us/op
WorkloadJitting  1: 1 op, 5162540000.00 ns, 5.1625 s/op

WorkloadWarmup   1: 1 op, 4688713200.00 ns, 4.6887 s/op
WorkloadWarmup   2: 1 op, 4791019900.00 ns, 4.7910 s/op
WorkloadWarmup   3: 1 op, 4762101400.00 ns, 4.7621 s/op
WorkloadWarmup   4: 1 op, 4905291500.00 ns, 4.9053 s/op
WorkloadWarmup   5: 1 op, 4981192100.00 ns, 4.9812 s/op
WorkloadWarmup   6: 1 op, 4897533000.00 ns, 4.8975 s/op

// BeforeActualRun
WorkloadActual   1: 1 op, 5169031400.00 ns, 5.1690 s/op
WorkloadActual   2: 1 op, 4802047400.00 ns, 4.8020 s/op
WorkloadActual   3: 1 op, 5088965000.00 ns, 5.0890 s/op
WorkloadActual   4: 1 op, 4936325600.00 ns, 4.9363 s/op
WorkloadActual   5: 1 op, 4980631400.00 ns, 4.9806 s/op
WorkloadActual   6: 1 op, 4762417600.00 ns, 4.7624 s/op
WorkloadActual   7: 1 op, 4822597700.00 ns, 4.8226 s/op
WorkloadActual   8: 1 op, 4987580400.00 ns, 4.9876 s/op
WorkloadActual   9: 1 op, 4775483100.00 ns, 4.7755 s/op
WorkloadActual  10: 1 op, 4989825800.00 ns, 4.9898 s/op
WorkloadActual  11: 1 op, 5192689700.00 ns, 5.1927 s/op
WorkloadActual  12: 1 op, 5080018600.00 ns, 5.0800 s/op
WorkloadActual  13: 1 op, 5016504700.00 ns, 5.0165 s/op
WorkloadActual  14: 1 op, 4806887800.00 ns, 4.8069 s/op
WorkloadActual  15: 1 op, 4736753000.00 ns, 4.7368 s/op
WorkloadActual  16: 1 op, 5184585300.00 ns, 5.1846 s/op
WorkloadActual  17: 1 op, 5219811200.00 ns, 5.2198 s/op
WorkloadActual  18: 1 op, 4834304800.00 ns, 4.8343 s/op
WorkloadActual  19: 1 op, 4787100400.00 ns, 4.7871 s/op
WorkloadActual  20: 1 op, 4679289100.00 ns, 4.6793 s/op
WorkloadActual  21: 1 op, 4830461200.00 ns, 4.8305 s/op
WorkloadActual  22: 1 op, 4636933400.00 ns, 4.6369 s/op
WorkloadActual  23: 1 op, 4706413600.00 ns, 4.7064 s/op
WorkloadActual  24: 1 op, 4972635200.00 ns, 4.9726 s/op
WorkloadActual  25: 1 op, 4521055700.00 ns, 4.5211 s/op
WorkloadActual  26: 1 op, 4887251400.00 ns, 4.8873 s/op
WorkloadActual  27: 1 op, 4873791300.00 ns, 4.8738 s/op
WorkloadActual  28: 1 op, 4839775000.00 ns, 4.8398 s/op
WorkloadActual  29: 1 op, 5198689300.00 ns, 5.1987 s/op
WorkloadActual  30: 1 op, 4858600000.00 ns, 4.8586 s/op
WorkloadActual  31: 1 op, 5046287000.00 ns, 5.0463 s/op
WorkloadActual  32: 1 op, 4670018300.00 ns, 4.6700 s/op
WorkloadActual  33: 1 op, 4931828400.00 ns, 4.9318 s/op
WorkloadActual  34: 1 op, 4664491500.00 ns, 4.6645 s/op
WorkloadActual  35: 1 op, 4961895500.00 ns, 4.9619 s/op
WorkloadActual  36: 1 op, 4756443300.00 ns, 4.7564 s/op
WorkloadActual  37: 1 op, 4699424600.00 ns, 4.6994 s/op
WorkloadActual  38: 1 op, 4777705700.00 ns, 4.7777 s/op
WorkloadActual  39: 1 op, 4751986700.00 ns, 4.7520 s/op
WorkloadActual  40: 1 op, 5026981900.00 ns, 5.0270 s/op
WorkloadActual  41: 1 op, 4829563900.00 ns, 4.8296 s/op

// AfterActualRun
WorkloadResult   1: 1 op, 5169031400.00 ns, 5.1690 s/op
WorkloadResult   2: 1 op, 4802047400.00 ns, 4.8020 s/op
WorkloadResult   3: 1 op, 5088965000.00 ns, 5.0890 s/op
WorkloadResult   4: 1 op, 4936325600.00 ns, 4.9363 s/op
WorkloadResult   5: 1 op, 4980631400.00 ns, 4.9806 s/op
WorkloadResult   6: 1 op, 4762417600.00 ns, 4.7624 s/op
WorkloadResult   7: 1 op, 4822597700.00 ns, 4.8226 s/op
WorkloadResult   8: 1 op, 4987580400.00 ns, 4.9876 s/op
WorkloadResult   9: 1 op, 4775483100.00 ns, 4.7755 s/op
WorkloadResult  10: 1 op, 4989825800.00 ns, 4.9898 s/op
WorkloadResult  11: 1 op, 5192689700.00 ns, 5.1927 s/op
WorkloadResult  12: 1 op, 5080018600.00 ns, 5.0800 s/op
WorkloadResult  13: 1 op, 5016504700.00 ns, 5.0165 s/op
WorkloadResult  14: 1 op, 4806887800.00 ns, 4.8069 s/op
WorkloadResult  15: 1 op, 4736753000.00 ns, 4.7368 s/op
WorkloadResult  16: 1 op, 5184585300.00 ns, 5.1846 s/op
WorkloadResult  17: 1 op, 5219811200.00 ns, 5.2198 s/op
WorkloadResult  18: 1 op, 4834304800.00 ns, 4.8343 s/op
WorkloadResult  19: 1 op, 4787100400.00 ns, 4.7871 s/op
WorkloadResult  20: 1 op, 4679289100.00 ns, 4.6793 s/op
WorkloadResult  21: 1 op, 4830461200.00 ns, 4.8305 s/op
WorkloadResult  22: 1 op, 4636933400.00 ns, 4.6369 s/op
WorkloadResult  23: 1 op, 4706413600.00 ns, 4.7064 s/op
WorkloadResult  24: 1 op, 4972635200.00 ns, 4.9726 s/op
WorkloadResult  25: 1 op, 4521055700.00 ns, 4.5211 s/op
WorkloadResult  26: 1 op, 4887251400.00 ns, 4.8873 s/op
WorkloadResult  27: 1 op, 4873791300.00 ns, 4.8738 s/op
WorkloadResult  28: 1 op, 4839775000.00 ns, 4.8398 s/op
WorkloadResult  29: 1 op, 5198689300.00 ns, 5.1987 s/op
WorkloadResult  30: 1 op, 4858600000.00 ns, 4.8586 s/op
WorkloadResult  31: 1 op, 5046287000.00 ns, 5.0463 s/op
WorkloadResult  32: 1 op, 4670018300.00 ns, 4.6700 s/op
WorkloadResult  33: 1 op, 4931828400.00 ns, 4.9318 s/op
WorkloadResult  34: 1 op, 4664491500.00 ns, 4.6645 s/op
WorkloadResult  35: 1 op, 4961895500.00 ns, 4.9619 s/op
WorkloadResult  36: 1 op, 4756443300.00 ns, 4.7564 s/op
WorkloadResult  37: 1 op, 4699424600.00 ns, 4.6994 s/op
WorkloadResult  38: 1 op, 4777705700.00 ns, 4.7777 s/op
WorkloadResult  39: 1 op, 4751986700.00 ns, 4.7520 s/op
WorkloadResult  40: 1 op, 5026981900.00 ns, 5.0270 s/op
WorkloadResult  41: 1 op, 4829563900.00 ns, 4.8296 s/op
GC:  0 0 0 106004328 1
Threading:  2445 0 1

// AfterAll
// Benchmark Process 29668 has exited with code 0

Mean = 4.885 s, StdErr = 0.027 s (0.55%), N = 41, StdDev = 0.173 s
Min = 4.521 s, Q1 = 4.762 s, Median = 4.840 s, Q3 = 4.990 s, Max = 5.220 s
IQR = 0.227 s, LowerFence = 4.421 s, UpperFence = 5.331 s
ConfidenceInterval = [4.789 s; 4.981 s] (CI 99.9%), Margin = 0.096 s (1.96% of Mean)
Skewness = 0.26, Kurtosis = 2.24, MValue = 2

// ***** BenchmarkRunner: Finish  *****

// * Export *
  BenchmarkDotNet.Artifacts\results\Benchmark.BenchmarkClass-report.csv
  BenchmarkDotNet.Artifacts\results\Benchmark.BenchmarkClass-report-github.md
  BenchmarkDotNet.Artifacts\results\Benchmark.BenchmarkClass-report.html

// * Detailed results *
BenchmarkClass.Execute: DefaultJob
Runtime = .NET Core 5.0.2 (CoreCLR 5.0.220.61120, CoreFX 5.0.220.61120), X64 RyuJIT; GC = Concurrent Workstation
Mean = 4.885 s, StdErr = 0.027 s (0.55%), N = 41, StdDev = 0.173 s
Min = 4.521 s, Q1 = 4.762 s, Median = 4.840 s, Q3 = 4.990 s, Max = 5.220 s
IQR = 0.227 s, LowerFence = 4.421 s, UpperFence = 5.331 s
ConfidenceInterval = [4.789 s; 4.981 s] (CI 99.9%), Margin = 0.096 s (1.96% of Mean)
Skewness = 0.26, Kurtosis = 2.24, MValue = 2
-------------------- Histogram --------------------
[4.455 s ; 4.587 s) | @
[4.587 s ; 4.747 s) | @@@@@@@
[4.747 s ; 4.923 s) | @@@@@@@@@@@@@@@@
[4.923 s ; 5.055 s) | @@@@@@@@@@
[5.055 s ; 5.286 s) | @@@@@@@
---------------------------------------------------

// * Summary *

BenchmarkDotNet=v0.12.1, OS=Windows 10.0.18363.959 (1909/November2018Update/19H2)
Intel Core i7-6700K CPU 4.00GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=5.0.102
  [Host]     : .NET Core 5.0.2 (CoreCLR 5.0.220.61120, CoreFX 5.0.220.61120), X64 RyuJIT
  DefaultJob : .NET Core 5.0.2 (CoreCLR 5.0.220.61120, CoreFX 5.0.220.61120), X64 RyuJIT


|  Method |    Mean |    Error |   StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|-------- |--------:|---------:|---------:|------:|------:|------:|----------:|
| Execute | 4.885 s | 0.0960 s | 0.1731 s |     - |     - |     - | 101.09 MB |

// * Legends *
  Mean      : Arithmetic mean of all measurements
  Error     : Half of 99.9% confidence interval
  StdDev    : Standard deviation of all measurements
  Gen 0     : GC Generation 0 collects per 1000 operations
  Gen 1     : GC Generation 1 collects per 1000 operations
  Gen 2     : GC Generation 2 collects per 1000 operations
  Allocated : Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)
  1 s       : 1 Second (1 sec)

// * Diagnostic Output - MemoryDiagnoser *


// ***** BenchmarkRunner: End *****
// ** Remained 0 benchmark(s) to run **
Run time: 00:04:00 (240.32 sec), executed benchmarks: 1

Global total time: 00:04:03 (243.8 sec), executed benchmarks: 1
// * Artifacts cleanup *

HTTP/2 benchmark test:

// BeforeAnythingElse

// Benchmark Process Environment Information:
// Runtime=.NET Core 5.0.2 (CoreCLR 5.0.220.61120, CoreFX 5.0.220.61120), X64 RyuJIT
// GC=Concurrent Workstation
// Job: DefaultJob

OverheadJitting  1: 1 op, 164200.00 ns, 164.2000 us/op
WorkloadJitting  1: 1 op, 29204792100.00 ns, 29.2048 s/op

WorkloadWarmup   1: 1 op, 29576980600.00 ns, 29.5770 s/op
WorkloadWarmup   2: 1 op, 26469932000.00 ns, 26.4699 s/op
WorkloadWarmup   3: 1 op, 27514975600.00 ns, 27.5150 s/op
WorkloadWarmup   4: 1 op, 28614916900.00 ns, 28.6149 s/op
WorkloadWarmup   5: 1 op, 28301241700.00 ns, 28.3012 s/op
WorkloadWarmup   6: 1 op, 24512659500.00 ns, 24.5127 s/op
WorkloadWarmup   7: 1 op, 30254852700.00 ns, 30.2549 s/op
WorkloadWarmup   8: 1 op, 26094880000.00 ns, 26.0949 s/op

// BeforeActualRun
WorkloadActual   1: 1 op, 32264387500.00 ns, 32.2644 s/op
WorkloadActual   2: 1 op, 25472289500.00 ns, 25.4723 s/op
WorkloadActual   3: 1 op, 28781951500.00 ns, 28.7820 s/op
WorkloadActual   4: 1 op, 28742581200.00 ns, 28.7426 s/op
WorkloadActual   5: 1 op, 30525960600.00 ns, 30.5260 s/op
WorkloadActual   6: 1 op, 28687627100.00 ns, 28.6876 s/op
WorkloadActual   7: 1 op, 35565412700.00 ns, 35.5654 s/op
WorkloadActual   8: 1 op, 32085104500.00 ns, 32.0851 s/op
WorkloadActual   9: 1 op, 34693116000.00 ns, 34.6931 s/op
WorkloadActual  10: 1 op, 32895600800.00 ns, 32.8956 s/op
WorkloadActual  11: 1 op, 27170791200.00 ns, 27.1708 s/op
WorkloadActual  12: 1 op, 26036678600.00 ns, 26.0367 s/op
WorkloadActual  13: 1 op, 29733935000.00 ns, 29.7339 s/op
WorkloadActual  14: 1 op, 25973529900.00 ns, 25.9735 s/op
WorkloadActual  15: 1 op, 27827091500.00 ns, 27.8271 s/op
WorkloadActual  16: 1 op, 27078766400.00 ns, 27.0788 s/op
WorkloadActual  17: 1 op, 26445929900.00 ns, 26.4459 s/op
WorkloadActual  18: 1 op, 29992976800.00 ns, 29.9930 s/op
WorkloadActual  19: 1 op, 28476811500.00 ns, 28.4768 s/op
WorkloadActual  20: 1 op, 32386656400.00 ns, 32.3867 s/op
WorkloadActual  21: 1 op, 28369239300.00 ns, 28.3692 s/op
WorkloadActual  22: 1 op, 26689712300.00 ns, 26.6897 s/op
WorkloadActual  23: 1 op, 28178685100.00 ns, 28.1787 s/op
WorkloadActual  24: 1 op, 28012557500.00 ns, 28.0126 s/op
WorkloadActual  25: 1 op, 31708776800.00 ns, 31.7088 s/op
WorkloadActual  26: 1 op, 34023858000.00 ns, 34.0239 s/op
WorkloadActual  27: 1 op, 30338892700.00 ns, 30.3389 s/op
WorkloadActual  28: 1 op, 29947852500.00 ns, 29.9479 s/op
WorkloadActual  29: 1 op, 32422993900.00 ns, 32.4230 s/op
WorkloadActual  30: 1 op, 28607864900.00 ns, 28.6079 s/op
WorkloadActual  31: 1 op, 28978476800.00 ns, 28.9785 s/op
WorkloadActual  32: 1 op, 31813635600.00 ns, 31.8136 s/op
WorkloadActual  33: 1 op, 30845827600.00 ns, 30.8458 s/op
WorkloadActual  34: 1 op, 26904340100.00 ns, 26.9043 s/op
WorkloadActual  35: 1 op, 29548184200.00 ns, 29.5482 s/op
WorkloadActual  36: 1 op, 33371009900.00 ns, 33.3710 s/op
WorkloadActual  37: 1 op, 29699550300.00 ns, 29.6996 s/op
WorkloadActual  38: 1 op, 25937753400.00 ns, 25.9378 s/op
WorkloadActual  39: 1 op, 30245911600.00 ns, 30.2459 s/op
WorkloadActual  40: 1 op, 30080595200.00 ns, 30.0806 s/op
WorkloadActual  41: 1 op, 25874589000.00 ns, 25.8746 s/op
WorkloadActual  42: 1 op, 31486464200.00 ns, 31.4865 s/op
WorkloadActual  43: 1 op, 27357412000.00 ns, 27.3574 s/op
WorkloadActual  44: 1 op, 30406149500.00 ns, 30.4061 s/op
WorkloadActual  45: 1 op, 29387948200.00 ns, 29.3879 s/op
WorkloadActual  46: 1 op, 24711794200.00 ns, 24.7118 s/op
WorkloadActual  47: 1 op, 25297962600.00 ns, 25.2980 s/op
WorkloadActual  48: 1 op, 31596880800.00 ns, 31.5969 s/op
WorkloadActual  49: 1 op, 27569116000.00 ns, 27.5691 s/op
WorkloadActual  50: 1 op, 26746015600.00 ns, 26.7460 s/op
WorkloadActual  51: 1 op, 27112120400.00 ns, 27.1121 s/op
WorkloadActual  52: 1 op, 26595454900.00 ns, 26.5955 s/op
WorkloadActual  53: 1 op, 27378460400.00 ns, 27.3785 s/op
WorkloadActual  54: 1 op, 26179511500.00 ns, 26.1795 s/op
WorkloadActual  55: 1 op, 26111812200.00 ns, 26.1118 s/op
WorkloadActual  56: 1 op, 31314994600.00 ns, 31.3150 s/op
WorkloadActual  57: 1 op, 27607733300.00 ns, 27.6077 s/op
WorkloadActual  58: 1 op, 27183957200.00 ns, 27.1840 s/op
WorkloadActual  59: 1 op, 28024470300.00 ns, 28.0245 s/op
WorkloadActual  60: 1 op, 30482891500.00 ns, 30.4829 s/op
WorkloadActual  61: 1 op, 30335580200.00 ns, 30.3356 s/op
WorkloadActual  62: 1 op, 27522602600.00 ns, 27.5226 s/op
WorkloadActual  63: 1 op, 24675288100.00 ns, 24.6753 s/op
WorkloadActual  64: 1 op, 32481784700.00 ns, 32.4818 s/op
WorkloadActual  65: 1 op, 28030212600.00 ns, 28.0302 s/op
WorkloadActual  66: 1 op, 32863265900.00 ns, 32.8633 s/op
WorkloadActual  67: 1 op, 26549489800.00 ns, 26.5495 s/op
WorkloadActual  68: 1 op, 29509954600.00 ns, 29.5100 s/op
WorkloadActual  69: 1 op, 37809682100.00 ns, 37.8097 s/op
WorkloadActual  70: 1 op, 30245426600.00 ns, 30.2454 s/op
WorkloadActual  71: 1 op, 27226532000.00 ns, 27.2265 s/op
WorkloadActual  72: 1 op, 32323673600.00 ns, 32.3237 s/op
WorkloadActual  73: 1 op, 26401358400.00 ns, 26.4014 s/op
WorkloadActual  74: 1 op, 29659517100.00 ns, 29.6595 s/op
WorkloadActual  75: 1 op, 27671457800.00 ns, 27.6715 s/op
WorkloadActual  76: 1 op, 28240115300.00 ns, 28.2401 s/op
WorkloadActual  77: 1 op, 29547425000.00 ns, 29.5474 s/op
WorkloadActual  78: 1 op, 29190261600.00 ns, 29.1903 s/op
WorkloadActual  79: 1 op, 31314600100.00 ns, 31.3146 s/op
WorkloadActual  80: 1 op, 27145792000.00 ns, 27.1458 s/op
WorkloadActual  81: 1 op, 28460064500.00 ns, 28.4601 s/op

Stopped here because it was taking way too long. You should get the idea based on the numbers shown above.

Analysis

What I have tried:

  • VPN to try and rule out anything ISP-related on my end.
  • Different web servers to ensure they aren't the bottleneck.

Neither made any noteworthy difference.

Another person appears to have this problem too.

Also some good information in this answer.

Could .NET be better-optimized for large HTTP/2 downloads? The performance difference surprised me. I'd love to see other peoples' benchmark results.

Author: EatonZ
Assignees: -
Labels:

area-System.Net.Http, tenet-performance, untriaged

Milestone: -

@EatonZ
Copy link
Contributor Author

EatonZ commented Jan 18, 2021

Interesting observation. When specifying HttpCompletionOption.ResponseHeadersRead and reading the response stream manually, it ends of reading in a lot more chunks: https://pastebin.com/kbxrjkwm

Compared to HTTP/1.1: https://pastebin.com/hfArNs5y

Maybe HTTP/1.1 is faster because it completes the read in larger/less chunks. Unfortunately it doesn't want to read in my large buffer size - it seems to top off at 40959.

var sw = new StreamWriter("chunks.txt");
var responseStream = await response.Content.ReadAsStreamAsync();
var totalRead = 0;
var buffer = new byte[1048576];
while (true)
{
    var bytesRead = await responseStream.ReadAsync(buffer);
    if (bytesRead == 0) break;
    sw.WriteLine(bytesRead);
    await DestinationStream.WriteAsync(new ReadOnlyMemory<byte>(buffer, 0, bytesRead));
    totalRead += bytesRead;
}
await sw.DisposeAsync();

@ManickaP
Copy link
Member

This is probably the very same problem as #43086.

Could you please confirm it by running the test with wireshark and checking whether WINDOW_UPDATE frames are sent very often?

If it's the case we should close this one as a dupe.

@EatonZ
Copy link
Contributor Author

EatonZ commented Jan 18, 2021

Thanks for the link. Looks like the same exact issue.

@EatonZ EatonZ closed this as completed Jan 18, 2021
@karelz
Copy link
Member

karelz commented Jan 19, 2021

Duplicate of #43086

@karelz karelz marked this as a duplicate of #43086 Jan 19, 2021
@karelz karelz added this to the 6.0.0 milestone Jan 26, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Feb 25, 2021
@karelz karelz removed the untriaged New issue has not been triaged by the area owner label Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants