Repository navigation
Replies: 1 comment
|
Thanks, @Stemonik. The measurements, the way you split the work, and the tests I'm in favour of the first road, step by step, and a good part of what you
I just published a few specs that are related, so you can see what we already
About how it would be offered: I'd like the socket engine to be one more server On TLS, I'd love to work through the design together, and we are not starting There is an open question where your view would help a lot: on Windows, should I'll reproduce the benchmark on my machine, so we can quote the numbers in the About DextWorkerIdle: yes, please send the PR. A hook that does nothing by |
Uh oh!
There was an error while loading. Please reload this page.
Hi Cesar,
The PRs I opened (#279, #280, #281, #282) come from one question: where does the fixed cost of a request go on Windows. The answer is mostly HTTP.sys itself. About 1.8 context switches per request happen in the kernel's own threads (System process), on top of ours; the same .NET application on HTTP.sys instead of Kestrel loses 35-75% on the same machine, so this is the price of HTTP.sys, not of Dext (Dext uses it better than Microsoft's own server does).
The IOCP socket engine that Dext already has does not pay that price. With #282, and a few lines in
TDextNativeWebServerto pick it on Windows (an environment switch in our bench), same machine, same binary:CPU per request on Select 1: 108 µs with HTTP.sys, 91 with sockets, almost all of the difference in the kernel (57 -> 42 µs). Against the other servers in the same run (Rust/axum, Go, .NET 10/Kestrel, Node, Spring Boot), Dext with the socket engine has the most requests per second on Select 1 and Select 50; the nearest, Rust, is 4-6% behind without auth. Everything, with the method and the raw data, is here: https://github.com/Stemonik/dext-benchmarks
What HTTP.sys gives today that the socket engine does not
IsSecureis False in the socket engine: "Phase 1/3 does not implement SSL yet");WithHttpSysTimeouts,WithQueueLength,WithMaxBandwidth): a slow client cannot hold a connection forever;The invitation
I think Dext on Windows deserves a server engine with these features and the speed of the socket engine. Two roads, and the choice is yours:
SO_EXCLUSIVEADDRUSE, then an option on the server builder to choose it. This is the road Kestrel took on Windows: a user-mode socket transport, TLS through SChannel;HTTP.sys would stay the right default for port sharing by prefix and for whoever wants the kernel to do the TLS.
If you choose the first road, I can take the pieces that need no design decision as separate PRs, with tests like those of #282: timeouts, chunked bodies, IPv6 and
SO_EXCLUSIVEADDRUSE, the option to choose the engine. TLS I would leave to you, or do it on a design you give me.P.S. One more small thing, measured separately: mimalloc (and other per-thread allocators) can trim a thread's heap only from that thread. A hook called once on a worker that handled work and then waited one second without any (
DextWorkerIdle, in the HTTP.sys and socket worker loops) lets the application do it: after a load it halves the private memory at rest, with no measurable cost under load. I can send it as a PR if you like the idea.Best regards,
Stefano
All reactions