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

Leverage of sendfile syscall ? #26

Open
wangjia184 opened this issue Feb 11, 2020 · 1 comment
Open

Leverage of sendfile syscall ? #26

wangjia184 opened this issue Feb 11, 2020 · 1 comment

Comments

@wangjia184
Copy link

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.

@stephank
Copy link
Owner

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: hyperium/hyper#140

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants