[Netcode] RpcSystem ECB Playback Frame Freeze Stalls
Solution
Unity 2022.3.x - Unity 6.3.x
Published Thu, Mar 26
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.
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:
- Open the Unity Profiler and locate the
RpcSystemwithin theComponentSystemGroup. - Enable the
RpcSystemJournaling feature to log incoming and outgoing RPC traffic. - Identify RPC calls exceeding expected per-frame frequency or payload limits.
- Implement throttling mechanisms or message batching for high-frequency data in place of individual RPCs.
- Verify that the
INetworkingSocketsreceive buffer is not saturated via transport-layer statistics.
Additional Tips
- Frame-based
RpcSystembudgets can be tracked usingSharedComponentDataor singletons. GhostVars(State Synchronization) are recommended for frequent data updates to reduceRpcSystemcommand buffer overhead.- Transport layer receive queue sizes should be verified to handle burst traffic without blocking the
RpcSystemplayback 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.