Skip to content

Missing feature: sendfile #45

Open

Description

@njsmith

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.

Activity

  1. njsmith commented on Jan 19, 2018

    @njsmith
    MemberAuthor

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

  2. sseg commented on Apr 14, 2018

    @sseg

    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?

  3. njsmith commented on Apr 14, 2018

    @njsmith
    MemberAuthor

    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?

  4. pipehappy1 commented on Jan 17, 2020

    @pipehappy1

    Do we have any update on this? Having sendfile in the API would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions