You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As an operator of a web application written with GenHTTP, I would like my application to provide high throughput, low latency and low memory allocations so I do not need to care about scaling that much.
Example
The current implementation of the ClientHandler wraps the socket obtained for the client into a NetworkStream that is then passed to a PipeReader for parsing purposes.
As all work is currently scheduled on the ThreadPool and the various streams inbetween the socket and the application framework cause a lot of allocations, the performance of the server cannot be improved without fundamentally changing this architecture.
Looking at Kestrel, we should:
Use IO threads to read and write from the socket
Use ThreadPool to actually handle requests in the application
Read the incoming data without streams into a pipe that can directly re-use the memory allocated by the socket
Allow to write outgoing data allocation free directly to the socket
Main question would be how to handle SSL connections without the functionality provided by SslStream.
Acceptance criteria
There is an implementation that uses IO threads to write and write to the underlying socket
There is an implementation that avoids the use of additional streams to avoid allocations
The implementation can be used with SSL while not implementing SSL handling itself
If the implementation has side effects when embedding GenHTTP into an UI based application, the new implementation must be activated via opt-in
The application tests still pass
It has been shown that the application no longer suffers from thread starvation (CPU in waiting state) within benchmarks (e.g. via dotTrace)
The application has been tested for allocations in a text-based hello world scenario and it can be shown that there are no massive allocations per request (e.g. via dotMemory)
The text was updated successfully, but these errors were encountered:
In Kestrel we have the Transport first (unencrypted) and then SSL on top as a Middleware via SslDuplexPipe. They create an SslStream from this pipe so we can re-use our logic with authentication I guess. Have to dig into this but this seems promising.
First benchmarks show that this is even a little bit slower but yet comparable to the traditional, way easier approach - so it seems that the implementation of the .NET framework already runs I/O asynchronously or we are missing something else that limits the performance.
As an operator of a web application written with GenHTTP, I would like my application to provide high throughput, low latency and low memory allocations so I do not need to care about scaling that much.
Example
The current implementation of the
ClientHandler
wraps the socket obtained for the client into aNetworkStream
that is then passed to aPipeReader
for parsing purposes.As all work is currently scheduled on the
ThreadPool
and the various streams inbetween the socket and the application framework cause a lot of allocations, the performance of the server cannot be improved without fundamentally changing this architecture.Looking at Kestrel, we should:
ThreadPool
to actually handle requests in the applicationSee this reference for a potential starting point: https://github.com/aykutalparslan/high-perfomance-tcp-server/
Main question would be how to handle SSL connections without the functionality provided by
SslStream
.Acceptance criteria
The text was updated successfully, but these errors were encountered: