Skip to content

feat: Batched write API for latency optimization #284

@aparatext

Description

@aparatext

When forwarding multiple packets immediately (e.g., proxy use case), there's no way to batch writes before TCP flush. With TCP_NODELAY enabled (as in examples), each Connection::write() call sends a separate TCP segment.

Proposed API:

conn.write_batch(&[packet1, packet2]).await?;`

or

conn.begin_batch();
conn.write(packet1).await?;
conn.write(packet2).await?;
conn.flush_batch().await?;

This would help proxies/servers optimize connection handshakes and burst scenarios.

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