question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting MinRequestBodyDataRate to null cause slow response time

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
BrennanConroycommented, Jun 8, 2020

@JunTaoLuo Could you take a look at this?

0reactions
BrennanConroycommented, Feb 26, 2021

Looks like we figured it out, using https://github.com/dotnet/aspnetcore/issues/30449 to track this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reading the request body timed out due to data arriving ...
Reading the request body timed out due to data arriving too slowly. See MinRequestBodyDataRate. But you are trying to set MinResponseDataRate .
Read more >
Configure options for the ASP.NET Core Kestrel web server
MinDataRate or attempts to set it to a value other than null result in a NotSupportedException for HTTP/2 requests.
Read more >
KestrelServerLimits.MinRequestBodyDataRate Property
Gets or sets the request body minimum data rate in bytes/second. Setting this property to null indicates no minimum data rate should be...
Read more >
Kestrel web server implementation in ASP.NET Core
The grace period helps avoid dropping connections that are initially sending data at a slow rate due to TCP slow-start. The default minimum...
Read more >
An Early Look at gRPC and ASP.NET Core 3.0 - Steve Gordon
In this post, I want to introduce my very early experience (after a few hours of experimentation) of gRPC and ASP.NET Core 3.0....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found