Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WebSocket Transport]: aggregate or cork writes to underlying transport (IDFGH-14105) #14914

Open
bryghtlabs-richard opened this issue Nov 20, 2024 · 0 comments
Assignees
Labels
Status: Opened Issue is new Type: Feature Request Feature request for IDF

Comments

@bryghtlabs-richard
Copy link
Contributor

bryghtlabs-richard commented Nov 20, 2024

Is your feature request related to a problem?

WebSocket writes (eventually calling tranport_ws.c's _ws_write() function) tend to create more packets than needed. This increases single packet upload latency from 1 packet to 3 packets:

  1. Client->Server: TLS send WebSocket header, Nagler blocks payload upload
  2. Server->Client: TCP ACK for WebSocket header packet, unblock Nagler
  3. Client->Server: TLS send WebSocket payload

Describe the solution you'd like.

I'd like _ws_write() to either batch writes to esp_transport_write(), or to add something like esp_transport_cork() and esp_transport_push() to the transport layer so that higher layer transports can combine writes that would then be sent only when esp_transport_push() is called.

Describe alternatives you've considered.

Nagle's algorithm doesn't help here - the first TLS packet containing the WebSocket frame headers is sent immediately, and the TLS packet containing the WebSocket payload deferred until the other side aknowledges the first TLS packet. Once the acknowledgement is received, the Nagler is disabled and the payload is uploaded.

Additional context.

image

@bryghtlabs-richard bryghtlabs-richard added the Type: Feature Request Feature request for IDF label Nov 20, 2024
@github-actions github-actions bot changed the title [WebSocket Transport]: aggregate or cork writes to underlying transport [WebSocket Transport]: aggregate or cork writes to underlying transport (IDFGH-14105) Nov 20, 2024
@espressif-bot espressif-bot added the Status: Opened Issue is new label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new Type: Feature Request Feature request for IDF
Projects
None yet
Development

No branches or pull requests

3 participants