Zen
Zen
#Overview
name: Zen
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 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Zen is to provide a high-performance caching and data management system for Unreal Engine 5. It serves as an integral part of the Derived Data Cache (DDC) system, offering improved performance and scalability for storing and retrieving derived data.
Zen is primarily used by the following Unreal Engine subsystems and modules:
- Derived Data Cache (DerivedDataCache module)
- Cook-on-the-Fly server (UnrealEd module)
- Editor tools (DerivedDataEditor module)
The value of Zen-related variables is typically set through configuration files or programmatically during engine initialization. In the provided code snippets, we can see examples of setting up Zen service settings and launching the Zen server.
Zen interacts with several other variables and systems, including:
- HTTP cache store settings
- File system paths (e.g., EngineSavedDir)
- Network settings (e.g., ports and protocols)
Developers should be aware of the following when using Zen:
- Zen requires proper configuration, including setting up the correct data paths and server settings.
- It can be used as an alternative to the traditional network file-based caching system.
- Zen provides a dashboard for monitoring and managing the cache system.
Best practices when using Zen include:
- Ensure proper initialization and configuration of Zen services before use.
- Use the provided API and interfaces (e.g., FZenCacheStore) to interact with the Zen system.
- Monitor Zen performance using the provided statistics and dashboard tools.
- Consider using Zen for large-scale projects or when improved caching performance is required.
- Keep the Zen installation up-to-date by checking for version updates.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:2570, section: [ZenOnlyDDC]
- INI Section:
ZenOnlyDDC
- Raw value:
(Type=Zen, ServerID=Local)
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Developer/DerivedDataCache/Private/Tests/HttpCacheStoreTest.cpp:618
Scope (from outer to inner):
file
namespace UE::DerivedData
function bool FHttpCacheStoreTest::RunTest
Source code excerpt:
#if UE_HTTPCACHESTORETEST_USE_ZEN
using namespace UE::Zen;
FServiceSettings ZenUpstreamTestServiceSettings;
FServiceAutoLaunchSettings& ZenUpstreamTestAutoLaunchSettings = ZenUpstreamTestServiceSettings.SettingsVariant.Get<FServiceAutoLaunchSettings>();
ZenUpstreamTestAutoLaunchSettings.DataPath = FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::EngineSavedDir(), "ZenUpstreamUnitTest"));
ZenUpstreamTestAutoLaunchSettings.ExtraArgs = FString::Printf(TEXT("--http asio --upstream-jupiter-url \"%s\" --upstream-jupiter-token \"%s\" --upstream-jupiter-namespace \"%s\""),
*TestDomain,
*TestAccessToken,
#Loc: <Workspace>/Engine/Source/Developer/DerivedDataCache/Private/ZenCacheStore.cpp:1753
Scope (from outer to inner):
file
namespace UE::DerivedData
function void FZenCacheStore::Initialize
Source code excerpt:
StoreOwner->Add(this, Flags);
TStringBuilder<256> Path(InPlace, ZenService.GetInstance().GetPath(), TEXTVIEW(" ("), Namespace, TEXTVIEW(")"));
StoreStats = StoreOwner->CreateStats(this, Flags, TEXT("Zen"), *Params.Name, Path);
bTryEvaluatePerformance = !GIsBuildMachine && (StoreStats != nullptr) && (DeactivateAtMs > 0.0f);
StoreStats->SetAttribute(TEXTVIEW("Namespace"), Namespace);
if (!bReady)
{
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenModule.cpp:13
Scope: file
Source code excerpt:
};
IMPLEMENT_MODULE(FDefaultModuleImpl, Zen)
#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:497
Scope (from outer to inner):
file
namespace UE::Zen
function static bool IsInstallVersionOutOfDate
Source code excerpt:
IsInstallVersionOutOfDate(const FString& InTreeUtilityPath, const FString& InstallUtilityPath, const FString& InTreeServicePath, const FString& InstallServicePath, FString& OutInTreeVersionCache, FString& OutInstallVersionCache)
{
OutInTreeVersionCache = FPaths::Combine(FPaths::EngineSavedDir(), TEXT("Zen"), TEXT("zen.version"));
OutInstallVersionCache = FPaths::SetExtension(InstallUtilityPath, TEXT("version"));
IFileManager& FileManager = IFileManager::Get();
if (!FileManager.FileExists(*InTreeUtilityPath) || !FileManager.FileExists(*InTreeServicePath))
{
UE_LOG(LogZenServiceInstance, Warning, TEXT("InTree version at '%s' is invalid"), *InTreeServicePath);
#Loc: <Workspace>/Engine/Source/Developer/Zen/Tests/ZenTest.cpp:15
Scope (from outer to inner):
file
namespace UE
Source code excerpt:
TEST_CASE("Zen::ZenServerInterface", "[Zen][Basic]")
{
using namespace UE::Zen;
uint16 DefaultTestPort = 8559;
uint16 CurrentTestPort = DefaultTestPort + 1;
FString DefaultArgs = TEXT("--http asio");
FString DataPathRoot = FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::EngineSavedDir(), "ZenServerInterfaceUnitTest"));
FString DefaultDataPath = FPaths::ConvertRelativePathToFull(FPaths::Combine(DataPathRoot, "Default"));
IFileManager::Get().DeleteDirectory(*DataPathRoot, false, true);
#Loc: <Workspace>/Engine/Source/Editor/DerivedDataEditor/Private/SDerivedDataStatusBar.cpp:112
Scope (from outer to inner):
file
function void FDerivedDataStatusBarMenuCommands::LaunchZenDashboard_Clicked
Source code excerpt:
void FDerivedDataStatusBarMenuCommands::LaunchZenDashboard_Clicked()
{
using namespace UE::Zen;
FZenDashboardLauncher::Get()->StartZenDashboard(FZenDashboardLauncher::Get()->GetZenDashboardApplicationPath());
}
TSharedRef<SWidget> SDerivedDataStatusBarWidget::CreateStatusBarMenu()
{
UToolMenu* Menu = UToolMenus::Get()->RegisterMenu("StatusBar.ToolBar.DDC", NAME_None, EMultiBoxType::Menu, false);
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/CookOnTheFlyServer.cpp:616
Scope (from outer to inner):
file
function bool UCookOnTheFlyServer::StartCookOnTheFly
Source code excerpt:
UE_LOG(LogCook, Display, TEXT("Starting '%s' cook-on-the-fly server"),
IsUsingZenStore() ? TEXT("Zen") : TEXT("Network File"));
FCookOnTheFlyNetworkServerOptions NetworkServerOptions;
NetworkServerOptions.Protocol = CookOnTheFlyOptions->bPlatformProtocol ? ECookOnTheFlyNetworkServerProtocol::Platform : ECookOnTheFlyNetworkServerProtocol::Tcp;
NetworkServerOptions.Port = CookOnTheFlyOptions->bBindAnyPort ? 0 : -1;
if (!InCookOnTheFlyOptions.TargetPlatforms.IsEmpty())
{
NetworkServerOptions.TargetPlatforms = InCookOnTheFlyOptions.TargetPlatforms;