Skip to content

net: support zero-copy send on TCPConn when reading from File via SectionReader #61727

@CAFxX

Description

@CAFxX

Currently net.TCPConn has dedicated support for this, but only for LimitedReader. Having dedicated support also for SectionReader would allow using the same FD concurrently to send the same file to multiple TCP connections, as well as supporting other use-cases (e.g. range requests).

This is obviously currently possible but without zero-copy support, resulting in the fallback genericReadFrom being used (that, in addition to requiring more syscalls, also requires more allocations):

image

I have a PoC for this on deea4f6

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performance

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions