Unity-Technologies / com.unity.netcode.gameobjects

Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer.
MIT License
2.09k stars 430 forks source link

perf: Adjust maximum reliable resend timeout in UTP #2766

Closed simon-lemay-unity closed 7 months ago

simon-lemay-unity commented 7 months ago

This PR increases the maximum resend timeout of UTP's reliable pipeline from 200 to 500 milliseconds (750 if using Relay). We've noticed that for bad connections and/or on servers that are heavily loaded (and thus take more time to process packets), the default maximum resend timeout could cause resends not because a packet was lost, but just because the RTT was high enough to be above the timeout. This causes wasted bandwidth, and for a server that is heavily loaded, will only compound the load problem since clients will keep resending traffic to it useless, which it will have to process.

Because UTP calculates the live RTT and uses that to determine resends, this change should not negatively impact performance for connections with good RTT. The minimum resend timeout (64 milliseconds) is also left unchanged.

Changelog

N/A (Don't think it's worth mentioning in the changelog.)

Testing and Documentation