MessageBus.UDP.CheckForExpiredWithFullQueue

MessageBus.UDP.CheckForExpiredWithFullQueue

#Overview

name: MessageBus.UDP.CheckForExpiredWithFullQueue

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 MessageBus.UDP.CheckForExpiredWithFullQueue is to manage network congestion in the UDP messaging system of Unreal Engine 5. It specifically attempts to release pressure on the work queue by checking if inflight segments have expired without acknowledgment.

This setting variable is primarily used in the UDP Messaging plugin, which is part of Unreal Engine’s networking and messaging subsystem. Based on the callsites, it’s clear that this variable is utilized within the UdpMessageProcessor module.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0, but can be changed at runtime through console commands or configuration files.

The associated variable CVarCheckForExpiredWithFullQueue directly interacts with MessageBus.UDP.CheckForExpiredWithFullQueue. They share the same value and purpose.

Developers must be aware that:

  1. This variable is used to manage network congestion scenarios.
  2. When enabled (set to a value > 0), it triggers a mechanism to check for and remove expired segments when the work queue is full.
  3. It’s a performance-tuning parameter that can impact how the UDP messaging system handles high-load situations.

Best practices when using this variable include:

  1. Only enable it (set to a value > 0) when experiencing issues with UDP message congestion.
  2. Monitor the logs for warnings about full work queues when this feature is active.
  3. Use in conjunction with other UDP messaging settings for optimal performance.
  4. Test thoroughly in your specific network environment to ensure it improves rather than degrades performance.

Regarding the associated variable CVarCheckForExpiredWithFullQueue:

The purpose of CVarCheckForExpiredWithFullQueue is identical to MessageBus.UDP.CheckForExpiredWithFullQueue. It’s the actual console variable implementation that controls the behavior described above.

This variable is used in the UdpMessageProcessor class to determine whether to attempt expiring old inflight segments when the work queue is full. It’s checked in the UpdateSegmenters function of the FUdpMessageProcessor class.

The value is set through the TAutoConsoleVariable template, which allows it to be changed at runtime.

CVarCheckForExpiredWithFullQueue directly controls the behavior defined by MessageBus.UDP.CheckForExpiredWithFullQueue. There are no other variables that interact with it directly based on the provided information.

Developers should be aware that:

  1. This is a runtime-configurable variable.
  2. Its value is checked on any thread, which means it should be used with thread-safety in mind.

Best practices include:

  1. Use the GetValueOnAnyThread() method to retrieve its value, as shown in the code example.
  2. Consider the performance implications of frequently checking this value in critical code paths.
  3. Document any changes to this variable’s value in your project, as it can significantly affect network behavior.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Messaging/UdpMessaging/Source/UdpMessaging/Private/Transport/UdpMessageProcessor.cpp:43

Scope: file

Source code excerpt:


TAutoConsoleVariable<int32> CVarCheckForExpiredWithFullQueue(
	TEXT("MessageBus.UDP.CheckForExpiredWithFullQueue"),
	0,
	TEXT("Attempts to release pressure on the work queue by checking if inflight segments have expired with no acknowledgement.\n"),
	ECVF_Default);


namespace UE::Private::MessageProcessor

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Messaging/UdpMessaging/Source/UdpMessaging/Private/Transport/UdpMessageProcessor.cpp:42

Scope: file

Source code excerpt:

	ECVF_Default);

TAutoConsoleVariable<int32> CVarCheckForExpiredWithFullQueue(
	TEXT("MessageBus.UDP.CheckForExpiredWithFullQueue"),
	0,
	TEXT("Attempts to release pressure on the work queue by checking if inflight segments have expired with no acknowledgement.\n"),
	ECVF_Default);

#Loc: <Workspace>/Engine/Plugins/Messaging/UdpMessaging/Source/UdpMessaging/Private/Transport/UdpMessageProcessor.cpp:1311

Scope (from outer to inner):

file
function     int32 FUdpMessageProcessor::UpdateSegmenters

Source code excerpt:

	}

	if (CVarCheckForExpiredWithFullQueue.GetValueOnAnyThread() > 0 && !NodeInfo.CanSendSegments() && NodeInfo.WorkQueue.IsFull())
	{
		UE_LOG(LogUdpMessaging, Warning, TEXT("Work queue is full sending to node at address %s. We cannot send new data. Attempting to expire old inflight segments."), *NodeInfo.Endpoint.ToString());
		// RemoveLostSegments will clean-up the tracking map that we use to determine what is "inflight". Old data will be expired and scheduled
		// for resend.
		NodeInfo.RemoveLostSegments(CurrentTime);
	}