RunningThreadedRequestLimit

RunningThreadedRequestLimit

#Overview

name: RunningThreadedRequestLimit

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of RunningThreadedRequestLimit is to control the maximum number of concurrent threaded HTTP requests that can be executed simultaneously in Unreal Engine’s HTTP module.

This setting variable is primarily used by the HTTP module of Unreal Engine, specifically within the HttpThread subsystem. It’s an important part of managing network requests and controlling resource usage in the engine.

The value of this variable is set in two possible ways:

  1. Through the engine configuration files (GEngineIni for general use, or GEditorIni specifically for the editor).
  2. If not found in the configuration files, it defaults to INT_MAX, effectively meaning no limit.

The variable interacts with other parts of the HTTP system, particularly the request queue and thread management components. It directly influences how many HTTP requests can be processed concurrently.

Developers must be aware of several things when using this variable:

  1. It must be configured as a number greater than 0. The system will ignore values less than 1 and log a warning.
  2. This limit applies to threaded requests only, not to all HTTP requests.
  3. Changing this value can significantly impact network performance and resource usage.

Best practices when using this variable include:

  1. Set an appropriate limit based on your application’s needs and the target hardware capabilities.
  2. Monitor network performance and adjust the limit as necessary.
  3. Consider different limits for editor and runtime environments.
  4. Use this in conjunction with other HTTP settings for optimal performance.
  5. Be cautious about setting this too high, as it could lead to resource exhaustion.
  6. Regularly review and update this setting as your project’s networking needs evolve.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:47, section: [HTTP.HttpThread]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Online/HTTP/Private/HttpThread.cpp:146

Scope (from outer to inner):

file
function     void FHttpThreadBase::UpdateConfigs

Source code excerpt:

		GConfig->GetInt(TEXT("HTTP.HttpThread"), TEXT("RunningThreadedRequestLimitEditor"), LocalRunningThreadedRequestLimit, GEditorIni) ||
#endif
		GConfig->GetInt(TEXT("HTTP.HttpThread"), TEXT("RunningThreadedRequestLimit"), LocalRunningThreadedRequestLimit, GEngineIni)
	);
	if (bFoundLocalRunningThreadedRequestLimit)
	{
		if (LocalRunningThreadedRequestLimit < 1)
		{
			UE_LOG(LogHttp, Warning, TEXT("RunningThreadedRequestLimit must be configured as a number greater than 0. The configured value is %d. Ignored. The current value is still %d"), LocalRunningThreadedRequestLimit, RunningThreadedRequestLimit.load());
		}
		else
		{
			RunningThreadedRequestLimit = LocalRunningThreadedRequestLimit;
		}
	}
}

void FHttpThreadBase::HttpThreadTick(float DeltaSeconds)
{

#Loc: <Workspace>/Engine/Source/Runtime/Online/HTTP/Private/HttpThread.cpp:177

Scope (from outer to inner):

file
function     int32 FHttpThreadBase::GetRunningThreadedRequestLimit

Source code excerpt:

int32 FHttpThreadBase::GetRunningThreadedRequestLimit() const
{
	return RunningThreadedRequestLimit.load();
}

void FHttpThreadBase::Stop()
{
	// empty
}

#Loc: <Workspace>/Engine/Source/Runtime/Online/HTTP/Private/HttpThread.h:157

Scope (from outer to inner):

file
class        class FHttpThreadBase : FRunnable, FSingleThreadRunnable

Source code excerpt:


	/** Limit for threaded http requests running at the same time. If not specified through configuration values, there will be no limit */
	std::atomic<int32> RunningThreadedRequestLimit = INT_MAX;

	/** Last time the thread has been processed. Used in the non-game thread. */
	double LastTime;

protected:
	/**