UnityRef is currently in early development. Some features may be incomplete and/or not functioning.

UNITYREF

Your Pit Stop For Solving ANYTHING in Unity

optimization

[Netcode] RpcSystem ECB Playback Frame Freeze Stalls

Solution

networkingperformanceoptimizationserver

Unity 2022.3.x - Unity 6.3.x

Published Thu, Mar 26

Issue

 A server experiences progressive frame freezes during EntityCommandBuffer.Playback in the RpcSystem, eventually leading to client timeouts. Profiling indicates the RpcSystem ECB playback is the primary source of these stalls in deterministic lockstep architectures using Steam INetworkingSockets, even when structural changes are not explicitly excessive.

Server-side frame freezes during RpcSystem playback are often caused by RPC flooding that overwhelms the network receive queue and forces intensive command buffer playback.

Explanation

A high volume of incoming packets processed by the RpcSystem during the EntityCommandBuffer playback phase causes the observed frame freezes. CPU spikes are induced in deterministic lockstep architectures when the receive buffer becomes congested, leading to intensive command buffer playback for remote calls.

The following steps are required to resolve the performance bottleneck:

  1. Open the Unity Profiler and locate the RpcSystem within the ComponentSystemGroup.
  2. Enable the RpcSystem Journaling feature to log incoming and outgoing RPC traffic.
  3. Identify RPC calls exceeding expected per-frame frequency or payload limits.
  4. Implement throttling mechanisms or message batching for high-frequency data in place of individual RPCs.
  5. Verify that the INetworkingSockets receive buffer is not saturated via transport-layer statistics.

Additional Tips

  • Frame-based RpcSystem budgets can be tracked using SharedComponentData or singletons.
  • GhostVars (State Synchronization) are recommended for frequent data updates to reduce RpcSystem command buffer overhead.
  • Transport layer receive queue sizes should be verified to handle burst traffic without blocking the RpcSystem playback phase.

Related Posts Haven't quite found a solution to your problem? We think these posts might help you.

Content inspired by a Unity discussion post.