Skip to content

Add optional chunked response writes with tryWrite - #1960

Open
GetThatCookie wants to merge 1 commit into
uNetworking:masterfrom
GetThatCookie:tryWrite
Open

GetThatCookie wants to merge 1 commit into
uNetworking:masterfrom
GetThatCookie:tryWrite

Conversation

@GetThatCookie

Copy link
Copy Markdown
Contributor

I started over from master with a focused alternative to #1922, following the feedback there.

The goal is proper backpressure for unknown-length responses through tryWrite(data, finalChunk = false). Unaccepted body data stays with the caller, retries use onWritable, and the TCP path combines corked headers, body and framing in one send.

For the ultimate-express 2.2.1 streaming workload with 5 MiB responses in 64 KiB chunks:

Path Requests/sec
write 1,840
tryWrite 2,599

+41.3% throughput, measured across five runs with 64 connections on Linux loopback.

In the native backpressure test with 64 stalled TCP clients and shared payload data, additional process RSS dropped from 214 MiB to 20 KiB.

Companion: uSockets/tryWrite.

Write chunk bodies without buffering unaccepted data, preserve body offsets across retries, and support final chunks. Combine corked headers, body and framing in one TCP send when possible.

Add a streaming example and backpressure regression coverage, and pin the companion uSockets changes.
Comment thread .gitmodules
[submodule "uSockets"]
path = uSockets
url = https://github.com/uNetworking/uSockets.git
url = https://github.com/GetThatCookie/uSockets.git

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

@uNetworkingAB

Copy link
Copy Markdown
Contributor

Does this rely on uSockets changes?

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants