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:
Server->Client: TCP ACK for WebSocket header packet, unblock Nagler
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.
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:
Describe the solution you'd like.
I'd like _ws_write() to either batch writes to
esp_transport_write()
, or to add something likeesp_transport_cork()
andesp_transport_push()
to the transport layer so that higher layer transports can combine writes that would then be sent only whenesp_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.