Setting MinRequestBodyDataRate to null cause slow response time
See original GitHub issueDescribe 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).
- Download the server side app: WebApplicationServer.zip, extract and open
.sln
file in VS. - Publish and run the
WebApplicationServer.exe
file. - Download the client side app WebApplication1.zip, extract, open
.sln
file in VS and build the project. - Go to line 61 in
Controllers/HomeController.cs
and change the url variable to theWebApplicationServer
app url and run - 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
- Close
WebApplicationServer.exe
, open back theWebApplicationServer
app in VS. - Comment line 20 in
Program.cs
, publish and run theWebApplicationServer.exe
. - 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:
- Created 3 years ago
- Comments:9 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@JunTaoLuo Could you take a look at this?
Looks like we figured it out, using https://github.com/dotnet/aspnetcore/issues/30449 to track this issue.