Skip to content

Setting MinRequestBodyDataRate to null cause slow response time #21502

Closed
@garayx

Description

@garayx

Describe the bug

Adding Limits.MinRequestBodyDataRate = null configuration to kestrel server will add ~40ms to response time when connection using .net framework client.

This doesn't reproduce when:

  • using .net core client.
  • both server & client are localhost

To Reproduce

Make sure running the server app on other host then the client app, or access the server app from the client via internet (open 5000 port and use public ip).

  1. Download the server side app: WebApplicationServer.zip, extract and open .sln file in VS.
  2. Publish and run the WebApplicationServer.exe file.
  3. Download the client side app WebApplication1.zip, extract, open .sln file in VS and build the project.
  4. Go to line 61 in Controllers/HomeController.cs and change the url variable to the WebApplicationServer app url and run
  5. In the running client app, go to the Query page, you should get similar results:
round: 0, elapsed: 459 ms
round: 1, elapsed: 41 ms
round: 2, elapsed: 41 ms
round: 3, elapsed: 41 ms
round: 4, elapsed: 42 ms
round: 5, elapsed: 41 ms
round: 6, elapsed: 41 ms
round: 7, elapsed: 42 ms
round: 8, elapsed: 41 ms
round: 9, elapsed: 40 ms
round: 10, elapsed: 41 ms

Max: 42 ms, min: 40 ms
Last 10 average: 79.09 ms, overall average: 79.09 ms
  1. Close WebApplicationServer.exe, open back the WebApplicationServer app in VS.
  2. Comment line 20 in Program.cs, publish and run the WebApplicationServer.exe.
  3. Go back to the client, refresh the Query page, you should get similar results:
round: 0, elapsed: 149 ms
round: 1, elapsed: 3 ms
round: 2, elapsed: 1 ms
round: 3, elapsed: 1 ms
round: 4, elapsed: 1 ms
round: 5, elapsed: 1 ms
round: 6, elapsed: 1 ms
round: 7, elapsed: 1 ms
round: 8, elapsed: 1 ms
round: 9, elapsed: 1 ms
round: 10, elapsed: 1 ms

Max: 3 ms, min: 1 ms
Last 10 average: 14.64 ms, overall average: 14.64 ms

Further technical details

  • ASP.NET Core 3.1.3
  • output of dotnet --info
dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.201
 Commit:    b1768b4ae7

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18363
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.201\

Host (useful for support):
  Version: 3.1.3
  Commit:  4a9f85e9f8

.NET Core SDKs installed:
  2.2.207 [C:\Program Files\dotnet\sdk]
  3.1.102 [C:\Program Files\dotnet\sdk]
  3.1.201 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  • The IDE is VS 2019, version 16.5.4

Metadata

Metadata

Assignees

Labels

affected-very-fewThis issue impacts very few customersarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsinvestigateseverity-nice-to-haveThis label is used by an internal tooltask

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions