net.ReliableRPCQueueSize

net.ReliableRPCQueueSize

#Overview

name: net.ReliableRPCQueueSize

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of net.ReliableRPCQueueSize is to control the maximum number of reliable Remote Procedure Calls (RPCs) that can be queued per object in Unreal Engine’s networking system. This setting is crucial for managing network traffic and ensuring smooth communication between server and clients in multiplayer games.

This setting variable is primarily used by the Iris networking subsystem, specifically within the AttachmentReplication module. It’s part of the experimental Iris Core, which is likely an updated or alternative networking system in Unreal Engine 5.

The value of this variable is set to 4096 by default, as seen in the code excerpt. It’s implemented as a console variable, which means it can be adjusted at runtime through the console or configuration files.

The ReliableRPCQueueSize interacts with other networking-related variables, such as UnreliableRPCQueueSize and ClientToServerUnreliableRPCQueueSize. These variables work together to manage different aspects of RPC queuing based on reliability and direction of communication.

Developers must be aware that this queue size is in addition to the 256 RPCs that are in the send window. This extra capacity is specifically to support very large RPCs that are split into smaller pieces.

Best practices when using this variable include:

  1. Monitoring network performance and adjusting the value if necessary.
  2. Being cautious about setting it too high, as it could lead to increased memory usage.
  3. Considering the trade-offs between queue size and potential latency in RPC execution.

Regarding the associated variable ReliableRPCQueueSize:

The purpose of ReliableRPCQueueSize is essentially the same as net.ReliableRPCQueueSize. It’s the internal representation of the console variable within the C++ code.

This variable is used directly in the FNetObjectAttachmentSendQueue::FReliableSendQueue constructor to set the MaxPreQueueCount. This suggests that it directly influences the size of the queue used for sending reliable RPCs.

The value of this variable is set by the console variable system, allowing for runtime configuration.

It doesn’t appear to interact with other variables beyond its relationship with the console variable.

Developers should be aware that changing the console variable will affect this internal variable, which in turn affects the actual queue size used in the networking code.

Best practices include:

  1. Using the console variable for configuration rather than modifying this internal variable directly.
  2. Considering the impact on memory usage and network performance when adjusting this value.
  3. Testing thoroughly with different values in various network conditions to find the optimal setting for your specific game.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Iris/Core/Private/Iris/ReplicationSystem/AttachmentReplication.cpp:24

Scope (from outer to inner):

file
namespace    UE::Net::Private
namespace    AttachmentReplicationCVars

Source code excerpt:


	static int32 ReliableRPCQueueSize = 4096;
	FAutoConsoleVariableRef CVarReliableRPCQueueSize(TEXT("net.ReliableRPCQueueSize"), ReliableRPCQueueSize, TEXT("Maximum number of reliable RPCs queued per object. This is in addition to the 256 that are in the send window. This is to support very large RPCs that are split into smaller pieces."));

	static int32 ClientToServerUnreliableRPCQueueSize = 16;
	FAutoConsoleVariableRef CVarClientToServerUnreliableRPCQueueSize(TEXT("net.ClientToServerUnreliableRPCQueueSize"), ClientToServerUnreliableRPCQueueSize, TEXT( "Maximum number of unreliable RPCs queued for sending from the client to the server. If more RPCs are queued then older ones will be dropped."));

	static int32 MaxSimultaneousObjectsWithRPCs = 4096;
	FAutoConsoleVariableRef CVarMaxSimultaneousObjectsWithRPCs(TEXT("net.MaxSimultaneousObjectsWithRPCs"), MaxSimultaneousObjectsWithRPCs, TEXT("Maximum number of objects that can have unsent RPCs at the same time. "));

#Associated Variable and Callsites

This variable is associated with another variable named ReliableRPCQueueSize. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Iris/Core/Private/Iris/ReplicationSystem/AttachmentReplication.cpp:23

Scope (from outer to inner):

file
namespace    UE::Net::Private
namespace    AttachmentReplicationCVars

Source code excerpt:

	FAutoConsoleVariableRef CVarUnreliableRPCQueueSize(TEXT("net.UnreliableRPCQueueSize"), UnreliableRPCQueueSize, TEXT("Maximum number of unreliable RPCs queued per object. If more RPCs are queued then older ones will be dropped."));

	static int32 ReliableRPCQueueSize = 4096;
	FAutoConsoleVariableRef CVarReliableRPCQueueSize(TEXT("net.ReliableRPCQueueSize"), ReliableRPCQueueSize, TEXT("Maximum number of reliable RPCs queued per object. This is in addition to the 256 that are in the send window. This is to support very large RPCs that are split into smaller pieces."));

	static int32 ClientToServerUnreliableRPCQueueSize = 16;
	FAutoConsoleVariableRef CVarClientToServerUnreliableRPCQueueSize(TEXT("net.ClientToServerUnreliableRPCQueueSize"), ClientToServerUnreliableRPCQueueSize, TEXT( "Maximum number of unreliable RPCs queued for sending from the client to the server. If more RPCs are queued then older ones will be dropped."));

	static int32 MaxSimultaneousObjectsWithRPCs = 4096;
	FAutoConsoleVariableRef CVarMaxSimultaneousObjectsWithRPCs(TEXT("net.MaxSimultaneousObjectsWithRPCs"), MaxSimultaneousObjectsWithRPCs, TEXT("Maximum number of objects that can have unsent RPCs at the same time. "));

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Iris/Core/Private/Iris/ReplicationSystem/AttachmentReplication.cpp:42

Scope (from outer to inner):

file
namespace    UE::Net::Private
class        class FNetObjectAttachmentSendQueue::FReliableSendQueue
function     FReliableSendQueue

Source code excerpt:

public:
	FReliableSendQueue()
	: MaxPreQueueCount(AttachmentReplicationCVars::ReliableRPCQueueSize)
	{
	}

	bool HasUnsentBlobs() const
	{
		return PreQueue.Num() > 0 || ReliableQueue.HasUnsentBlobs();