TCP_NODELAY
is disabled by default in WebSocket communication in 4.x, but was enabled by default in 3.x
#86234
Labels
Milestone
Tested versions
Reproducible in Godot 4.1, 4.2.1
System information
Godot Engine v4.2.1.stable.official.b09f793f5 - https://godotengine.org Vulkan API 1.3.236 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1660 Ti
Issue description
When utilizing WebSocket communication in Godot 4 with a remote server, there is a notable latency issue causing ping times to vary between 200ms and 300ms. This discrepancy is observed when compared to a similar project in Godot 3.5, where the ping ranges from 60ms to 90ms.
After investigation, it was found that disable the Nagle's algorithm using set_no_delay(true) for each WebSocketPeer significantly reduces the latency, bringing the ping down to 60-90ms. This behavior suggests that the default Nagle's algorithm implementation in Godot 4 might contribute to higher latency.
Note: The issue is not present in Godot 3.5, suggesting a change in the default behavior of WebSocket communication in Godot 4.
Proposed Solution:
Consider reviewing and optimizing the default implementation of Nagle's algorithm in Godot 4's WebSocket communication to achieve lower latency without the need for developers to manually disable the algorithm using set_no_delay(true).
It is recommended to document this optimization option in the WebSocket documentation, providing developers with information on how to improve latency by adjusting the Nagle's algorithm settings for their specific use cases.
Note: This report is submitted to bring attention to the observed latency issue and to suggest potential improvements for a smoother development experience in Godot 4.
Steps to reproduce
Create a Godot 4 project with WebSocket communication to a remote server.
Observe ping times ranging from 200ms to 300ms.
Disable Nagle's algorithm using set_no_delay(true) for each WebSocketPeer.
Observe a significant reduction in ping times to 60-90ms.
Expected behavior:
Ping times should be consistent and low without the need to disable Nagle's algorithm manually.
Minimal reproduction project (MRP)
test.zip
The text was updated successfully, but these errors were encountered: