Skip to content

Server response sending triggers Nagle's algorithm/delayed ACK interaction #199

Open
@kyrias

Description

@kyrias

The way the async-h1 encoder streams the HTTP response head and body to the given io: Write causes the head and body to be written to the underlying socket as separate calls to send, causing them to be sent as separate TCP segments.

If we're handling more than one HTTP request from the same io that means that we're doing two sends and then a read. This I/O pattern triggers a bad interaction between Nagle's algorithm and delayed ACK where the read can take up to 500 milliseconds. (On Linux this is 40 milliseconds.)

A work-around for this is to enable TCP_NODELAY to disable Nagle's algorithm, but we shouldn't really be sending undersized TCP segment unnecessarily.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions