Skip to content

net: Buffers makes multiple Write calls on Writers that don't implement buffersWriter #21676

@zombiezen

Description

@zombiezen

The writev syscall is supposed to act like a single write. The WriteTo method of net.Buffers will make a single write syscall on writers that have the unexported writeBuffers method. However, for writers that do not have such a method, it will call Write multiple times. This becomes significant if you are wrapping a *net.TCPConn without embedding, for instance, since it has different performance characteristics with respect to Nagle's algorithm. Frustratingly, since the writeBuffers method is unexported, there's no way for the application to know the behavior of Buffers.WriteTo in order to work around the issue.

Repro case: https://play.golang.org/p/rF0JRZs8z8

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.early-in-cycleA change that should be done early in the 3 month dev cycle.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions