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

Kestral is very slow when posting data #4711

Closed
cibinmathewjose opened this issue Oct 3, 2018 · 6 comments
Closed

Kestral is very slow when posting data #4711

cibinmathewjose opened this issue Oct 3, 2018 · 6 comments
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions feature-kestrel
Milestone

Comments

@cibinmathewjose
Copy link

Please get the sample source from https://github.com/cibinmathewjose/KestrelPostIssue.git
run the code and post {"Name":"test","Price":1} to http://{machine}:5000/api/products, it will take ~6 seconds.

if you post {"Price":1} to http://{machine}:5000/api/products it will work normally.

The put request endpoint is always slow with machine name url, regardless of the data posted.

Also if you use localhost instead of machine name in url, it will always works normal.
this is the same issue as #2229

@Tratcher
Copy link
Member

Tratcher commented Oct 3, 2018

That sounds suspiciously like firewall filters getting in the way. Kestrel has no control of things that happen below the Socket layer, and doesn't check the host name on requests.

@cibinmathewjose
Copy link
Author

I don’t think so, My firewall is turned off. Also it doesn’t happen when there is no “Name” property in the JSON payload for post method

@Tratcher
Copy link
Member

Tratcher commented Oct 3, 2018

When in doubt, simplify. Remove MVC from your sample and read the request body stream as text.

app.Run(async context =>
{
var bytes = new byte[100];
var read = await context.Request.Body.ReadAsync(bytes, 0, bytes.Length);
Encoding.UTF8.GetString(bytes, 0, read);
// etc..
});

@cibinmathewjose
Copy link
Author

cibinmathewjose commented Oct 4, 2018

that too have the same issue. I have modified the startup.cs as
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.Run(async context =>
{
var str = new StreamReader(context.Request.Body).ReadToEnd();
Console.Write(str);
});
}
Still it takes abnormal amount of time for all PUT request and POST with specific property (Name) in JSON payload

@cibinmathewjose
Copy link
Author

I have tried it in my personal laptop and it is working fine, but all machines in our corporate network and my official laptop has this issue. let me check with our IT team.

@aspnet-hello aspnet-hello transferred this issue from aspnet/KestrelHttpServer Dec 13, 2018
@aspnet-hello aspnet-hello added this to the Discussions milestone Dec 13, 2018
@aspnet-hello
Copy link

We periodically close 'discussion' issues that have not been updated in a long period of time.

We apologize if this causes any inconvenience. We ask that if you are still encountering an issue, please log a new issue with updated information and we will investigate.

@dotnet dotnet locked and limited conversation to collaborators Mar 11, 2019
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions feature-kestrel
Projects
None yet
Development

No branches or pull requests

4 participants