-
Notifications
You must be signed in to change notification settings - Fork 40
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
Some crazy error rate when testing ASP.NET Core API endpoints #35
Comments
Any logs on your asp.net server? The crazy rates you're getting with ASP is because the server seems just to be immediately closing the connection. Perhaps there's some weird additional check ASP is doing which is failing to cause it to close the connection? |
I disabled the HTTPS redirect so it should be something else. The logger was disabled due to performance reasons, but I will turn on the trace log and take a look. |
Ah, should've thought of giving the log a shot last night. Yes the log says "Invalid host header '127.0.0.1'". dbug: Microsoft.AspNetCore.Server.Kestrel.BadRequests[17]
Connection id "0HMKAI4MMDM1L" bad request data: "Invalid Host header: '127.0.0.1'"
Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Invalid Host header: '127.0.0.1'
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.ValidateNonOriginHostHeader(String hostText)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.EnsureHostHeaderExists()
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.TryParseRequest(ReadResult result, Boolean& endConnection)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequestsAsync[TContext](IHttpApplication`1 application)
dbug: Microsoft.AspNetCore.Server.Kestrel.Connections[2]
Connection id "0HMKAI4MMDM1L" stopped. |
Ah, looks like ASP is complaining that the To get around this you can probably override the header by passing the Anyway using the host flag should fix it so give it a go. |
Yep that did the trick. Thanks for your quick (in fact, instant:zap:) follow-up~ The difference compared to
Anyway, that's a topic for another issue if needed. Please close the issue as you see fit. |
I imagine it's probably down to
One way to check is to run a simple python Reason why we don't do pipelining: https://stackoverflow.com/questions/30477476/why-is-pipelining-disabled-in-modern-browsers |
Yeah, that might be the cause. With ~
> wrk -c 256 -t 12 -d 15s http://127.0.0.1:5000
Running 15s test @ http://127.0.0.1:5000
12 threads and 256 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 845.50us 724.26us 18.18ms 89.52%
Req/Sec 28.38k 7.57k 91.68k 83.03%
5093954 requests in 15.10s, 709.26MB read
Requests/sec: 337354.18
Transfer/sec: 46.97MB
~ took 15s
> rewrk -c 256 -t 12 -d 15s -h http://127.0.0.1:5000
Beginning round 1...
Benchmarking 256 connections @ http://127.0.0.1:5000 for 15 second(s)
Latencies:
Avg Stdev Min Max
0.90ms 0.45ms 0.04ms 7.59ms
Requests:
Total: 4238345 Req/Sec: 282822.26
Transfer:
Total: 590.13 MB Transfer Rate: 39.38 MB/Sec Still, not exactly the same but I'd consider them in the same ballpark. |
When benchmarking ASP.NET API endpoints,
rewrk
is yielding some bizarre numbers (unexpected low) and almost all requests got error responses. On the other hand, testing Rust API endpoints (Actix, Axum) and Node.js endpoints (Nest, Fastify) seems fine. Any thoughts? Thanks~I am running Fedora 36.
ASP.NET Core (.net 6 + Minimal API) result:
NestJS (w/ Fastify):
The text was updated successfully, but these errors were encountered: