Skip to content

HTTP2: Performance issues when many concurrent requests #35184

@JamesNK

Description

@JamesNK

HttpClient has performance issues when many concurrent calls are made on one connection. HttpClient is slower compared to Grpc.Core (a gRPC client that uses chttp2 native C library for HTTP/2).

Test app: https://github.com/JamesNK/Http2Perf

I have replicated a gRPC call being made using HttpClient to avoid complication from involving Grpc.Net.Client.

.NET version:

.NET SDK (reflecting any global.json):
 Version:   5.0.100-preview.4.20216.32
 Commit:    c492fe1552

HttpClient results:

  • 100 concurrent callers on one HTTP/2 connection with HttpClient (dotnet run -c Release -p GrpcSampleClient r 100 false): 19k RPS, 1-6ms latency
  • 100 concurrent callers on 100 HTTP/2 connections with HttpClient (dotnet run -c Release -p GrpcSampleClient r 100 true): 31k RPS, 1-8ms latency

Grpc.Core results:

  • 100 concurrent callers on one HTTP/2 connection with Grpc.Core (dotnet run -c Release -p GrpcSampleClient c 100 false): 59k RPS, 1-2ms latency
  • 100 concurrent callers on 100 HTTP/2 connections with Grpc.Core (dotnet run -c Release -p GrpcSampleClient c 100 true): 45k RPS, 1-2ms latency

Interesting that a connection per caller increases performance with HttpClient but decreases it with Grpc.Core.

With one caller HttpClient is faster than Grpc.Core (about 3k RPS vs 3.5k RPS) but as you can see in a 100 concurrent caller scenario Grpc.Core is three times faster.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions