net.ProcessQueuedBunchesMillisecondLimit
net.ProcessQueuedBunchesMillisecondLimit
#Overview
name: net.ProcessQueuedBunchesMillisecondLimit
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Time threshold for processing queued bunches. If it takes longer than this in a single frame, wait until the next frame to continue processing queued bunches. For unlimited time, set to 0.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of net.ProcessQueuedBunchesMillisecondLimit is to set a time threshold for processing queued network bunches in Unreal Engine’s networking system. It controls how long the engine can spend processing these bunches in a single frame before deferring the remaining work to the next frame.
This setting variable is primarily used in the networking subsystem of Unreal Engine, specifically in the data channel processing part. Based on the callsites, it’s used in the Engine module, within the DataChannel.cpp file.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 30 milliseconds, but can be changed at runtime through console commands or configuration files.
This variable interacts closely with another variable named CVarNetInstantReplayProcessQueuedBunchesMillisecondLimit, which serves a similar purpose but specifically for instant replay scenarios.
Developers must be aware that this variable directly impacts the performance and responsiveness of the networking system. Setting it too low might lead to network updates being spread across multiple frames, potentially causing delays. Setting it too high might cause frame rate drops if a large amount of network data needs to be processed.
Best practices when using this variable include:
- Monitor its impact on both network responsiveness and frame rate.
- Adjust it based on the specific needs of your game and target hardware.
- Consider different values for different scenarios (e.g., normal gameplay vs. instant replay).
- Remember that setting it to 0 removes the time limit, which could lead to performance issues if there’s a lot of network data to process.
Regarding the associated variable CVarNetProcessQueuedBunchesMillisecondLimit:
This is the actual console variable that stores the value for net.ProcessQueuedBunchesMillisecondLimit. It’s an integer variable that’s used to retrieve the current value of the setting in the game thread.
The purpose of this variable is to provide a way to access and modify the net.ProcessQueuedBunchesMillisecondLimit setting at runtime.
It’s used in the networking subsystem, specifically in the UActorChannel::ProcessQueuedBunches function, to determine how long the system can spend processing queued bunches.
The value is set when the engine initializes the console variables, but can be changed at runtime through console commands.
This variable interacts directly with net.ProcessQueuedBunchesMillisecondLimit, essentially serving as its storage and access point.
Developers should be aware that changes to this variable will immediately affect the networking behavior of the game. It’s important to use the appropriate getter method (GetValueOnGameThread()) when accessing it to ensure thread-safety.
Best practices include using the provided getter methods to access the value, and considering the performance implications of any changes made to this variable during runtime.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataChannel.cpp:74
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int> CVarNetProcessQueuedBunchesMillisecondLimit(
TEXT("net.ProcessQueuedBunchesMillisecondLimit"),
30,
TEXT("Time threshold for processing queued bunches. If it takes longer than this in a single frame, wait until the next frame to continue processing queued bunches. For unlimited time, set to 0."));
static TAutoConsoleVariable<int32> CVarNetInstantReplayProcessQueuedBunchesMillisecondLimit(
TEXT("net.InstantReplayProcessQueuedBunchesMillisecondLimit"),
8,
#Associated Variable and Callsites
This variable is associated with another variable named CVarNetProcessQueuedBunchesMillisecondLimit
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataChannel.cpp:73
Scope: file
Source code excerpt:
ECVF_Default);
static TAutoConsoleVariable<int> CVarNetProcessQueuedBunchesMillisecondLimit(
TEXT("net.ProcessQueuedBunchesMillisecondLimit"),
30,
TEXT("Time threshold for processing queued bunches. If it takes longer than this in a single frame, wait until the next frame to continue processing queued bunches. For unlimited time, set to 0."));
static TAutoConsoleVariable<int32> CVarNetInstantReplayProcessQueuedBunchesMillisecondLimit(
TEXT("net.InstantReplayProcessQueuedBunchesMillisecondLimit"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataChannel.cpp:2829
Scope (from outer to inner):
file
function bool UActorChannel::ProcessQueuedBunches
Source code excerpt:
// playback, the driver's DuplicateLevelID will be something other than INDEX_NONE.
const int BunchTimeLimit = Connection->Driver->GetDuplicateLevelID() == INDEX_NONE ?
CVarNetProcessQueuedBunchesMillisecondLimit.GetValueOnGameThread() :
CVarNetInstantReplayProcessQueuedBunchesMillisecondLimit.GetValueOnGameThread();
const bool bHasTimeToProcess = BunchTimeLimit == 0 || Connection->Driver->ProcessQueuedBunchesCurrentFrameMilliseconds < BunchTimeLimit;
// If we don't have any time, then don't bother doing anything (including warning) as that may make things worse.
if (bHasTimeToProcess)