Skip to content

TCP Read Optimization #74

@Orvaxis

Description

@Orvaxis

The current implementation shares contiguous bytes with an AsyncRead consumer through a channel. However, this approach prevents backpressure, which leads to significant memory consumption if the sending rate is too fast. Furthermore, because the buffered data is immediately sent to the channel, the TCP receive window does not shrink. This disables TCP-level flow control, further exacerbating memory accumulation.

The solution I've come up with is to create an ordered list of packets within the TCB. The consumption method, each time it's called, will move the contiguous packets into this list.
The window calculation will also be modified to determine the actual window size by accounting for the sizes of both the in-order (ordered) and out-of-order packets.
Then, in the AsyncRead implementation, it will get the TCB, pop the first packet from the ordered collection, and write it into the read buffer.

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