Leverage of sendfile syscall ?
sendfile(2) allows data to be transferred from a file descriptor to a TCP socket descriptor without paying the price of a copy round-trip through user space.
This is a great optimization for static file servers.
If the kernel(Version 4.13+) can handle KTLS(Kernel TLS offload), sendfile(2) can be used also for encrypted connections.
However, I am afraid the Rust ecosystem (hyper / rustls / etc) are ready. Just raise the idea here -- leverage of sendfile when it is avaiable.
I took a brief look at this as part of #24, but didn't try to implement it. Not sure why. Maybe because I too discovered Rust support is currently limited. 🙃
I do remember HTTPS was one of the issues. No matter how we implement this, it can only work with plain TCP sockets, and needs to fall back to the old way if that's not the case.
(kTLS is interesting, but this is also the first I hear of it. Maybe it'll work the same as long as the underlying socket is SOCK_STREAM.)
Hyper also has a (closed) issue about this: https://github.com/hyperium/hyper/issues/140