'Strange delays in websocket data transfer from Ubuntu-hosted wifi access point
I have an application that is streaming jpeg images from an Ubuntu machine over a wifi connection. The wifi network is an access point/SSID hosted on the Ubuntu machine that is streaming the images. I have run this in two scenarios, with very different results. In the first, I set up the wifi AP using an nmcli-driven script I wrote long ago. This gave me acceptable performance: just under 200 ms to transfer a ~500kb image over a websocket. We then changed the way the AP network was set up using nmtui. When the AP was set up this way, the performance got noticeably worse: the 500k jpeg now takes ~800ms to transfer. And, once this problem manifested, going back to instantiating the AP using the old script didn't help: the transfer time stayed stubbornly at ~800 ms. From this I conclude that some system level network setting got turned on/off in the process of using nmtui to instantiate the access point.
My question is this... Is there some setting (in linux or elsewhere) that could cause this? I was imagining something like a different setting on the size of the network send buffer, or some checksum process that runs every 12k bytes or so, or something similar. Might that be the problem? Or am I looking in the wrong place entirely?
More information: the wireshark view of the transfer (from the point of view of the laptop receiving the images) is interesting. Here are the first several packet fragments in the original (fast) configuration:
No. | Time | Source | Destination | Protocol | Length | Info | Time between TCP segments |
---|---|---|---|---|---|---|---|
3021 | 42.848808 | 192.168.5.1 | 192.168.5.175 | WebSocket | 1514 | WebSocket Binary [TCP segment of a reassembled PDU] | |
3024 | 42.848808 | 192.168.5.1 | 192.168.5.175 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0 |
3029 | 42.850256 | 192.168.5.1 | 192.168.5.175 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.001448 |
3033 | 42.853634 | 192.168.5.1 | 192.168.5.175 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.003378 |
3037 | 42.854018 | 192.168.5.1 | 192.168.5.175 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.000384 |
3040 | 42.85586 | 192.168.5.1 | 192.168.5.175 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.001842 |
3044 | 42.858978 | 192.168.5.1 | 192.168.5.175 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.003118 |
3047 | 42.858978 | 192.168.5.1 | 192.168.5.175 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0 |
3051 | 42.859479 | 192.168.5.1 | 192.168.5.175 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.000501 |
3056 | 42.863421 | 192.168.5.1 | 192.168.5.175 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.003942 |
3058 | 42.863421 | 192.168.5.1 | 192.168.5.175 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0 |
3062 | 42.867284 | 192.168.5.1 | 192.168.5.175 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.003863 |
3065 | 42.867284 | 192.168.5.1 | 192.168.5.175 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0 |
3069 | 42.869294 | 192.168.5.1 | 192.168.5.175 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.00201 |
3073 | 42.870653 | 192.168.5.1 | 192.168.5.175 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.001359 |
Compare that with the slower version:
No. | Time | Source | Destination | Protocol | Length | Info | Time between packet fragments |
---|---|---|---|---|---|---|---|
2300 | 47.71488 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Binary [TCP segment of a reassembled PDU] | |
2304 | 47.716615 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.001735 |
2309 | 47.722165 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.00555 |
2313 | 47.724079 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.001914 |
2318 | 47.728149 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.00407 |
2321 | 47.730169 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.00202 |
2325 | 47.732195 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.002026 |
2330 | 47.736405 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.00421 |
2334 | 47.763687 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.027282 |
2339 | 47.768259 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.004572 |
2342 | 47.773175 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.004916 |
2346 | 47.775568 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.002393 |
2351 | 47.779664 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.004096 |
2355 | 47.782844 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.00318 |
2360 | 47.78672 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.003876 |
2363 | 47.788629 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.001909 |
2367 | 47.815898 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.027269 |
2372 | 47.819907 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.004009 |
2376 | 47.823592 | 10.0.2.1 | 10.0.2.198 | WebSocket | 1514 | WebSocket Continuation [TCP segment of a reassembled PDU] | 0.003685 |
Notice that, in the slower version, there is a much longer time gap (highlighted in bold) between TCP fragments occurring every ~12k bytes or so. (That is consistent- there is a big lag between fragments at predictable intervals in this scenario).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|