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

Missing feature: sendfile #45

Open
njsmith opened this Issue Feb 11, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@njsmith
Member

njsmith commented Feb 11, 2017

On Unix, os.sendfile is present and just needs a simple (but slightly finicky) wrapper.

On Windows, os.sendfile doesn't exist, but we can wrap TransmitFile - shouldn't be too hard.

@njsmith

This comment has been minimized.

Member

njsmith commented Jan 19, 2018

Asyncio support is coming in 3.7: https://bugs.python.org/issue32410

@sseg

This comment has been minimized.

sseg commented Apr 14, 2018

I started having a look at this but I'm not sure how you intend the API. Do you think that trio.socket.sendfile should accept AsyncIOWrapper, plain file objects, or both?

@njsmith

This comment has been minimized.

Member

njsmith commented Apr 14, 2018

Oh shoot, that's an excellent question. I was just thinking about wrapping sendfile in the obvious naive way, like we wrap send or whatever, but I forgot that this may cause synchronous disk access. And it's a bit tricky, because we could route it through a thread like we do with other disk access, but in this case that might add enough overhead to defeat the purpose of using sendfile in the first place. It's also unclear whether a thread is really necessary on Windows – maybe TransmitFile does async disk I/o natively?

It would help to have more information. I guess one way forward would be to start by making a toy little benchmark that uses sendfile in the naive way on Linux, and compare it to read+send, to see what benefit we can even hope to get?

@njsmith njsmith referenced this issue Sep 26, 2018

Open

Windows event notification #52

0 of 11 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment