aboutsummaryrefslogtreecommitdiff
path: root/zenserver/zenserver.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-10-19 22:22:10 +0200
committerStefan Boberg <[email protected]>2021-10-19 22:22:10 +0200
commita18ac1fadb2eba1f58e8c2e150a52a46aabda128 (patch)
tree9d1a1c950ad9c50d950cd0f5c7dfa40ae0163f56 /zenserver/zenserver.cpp
parentcas: Hooked up GC to structured cache (diff)
downloadzen-a18ac1fadb2eba1f58e8c2e150a52a46aabda128.tar.xz
zen-a18ac1fadb2eba1f58e8c2e150a52a46aabda128.zip
zenserver: disabled named pipes client and exec service by default
Diffstat (limited to 'zenserver/zenserver.cpp')
-rw-r--r--zenserver/zenserver.cpp34
1 files changed, 30 insertions, 4 deletions
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp
index c9b52604d..cfc5dd88d 100644
--- a/zenserver/zenserver.cpp
+++ b/zenserver/zenserver.cpp
@@ -16,6 +16,9 @@
#include <zenstore/cidstore.h>
#include <zenutil/zenserverprocess.h>
+#define ZEN_USE_NAMED_PIPES 0
+#define ZEN_USE_EXEC 0
+
#if ZEN_USE_MIMALLOC
ZEN_THIRD_PARTY_INCLUDES_START
# include <mimalloc-new-delete.h>
@@ -178,13 +181,18 @@ public:
m_ProjectStore = new zen::ProjectStore(*m_CasStore, m_DataRoot / "projects");
m_HttpProjectService.reset(new zen::HttpProjectService{*m_CasStore, m_ProjectStore});
+
+#if ZEN_USE_NAMED_PIPES
m_LocalProjectService = zen::LocalProjectService::New(*m_CasStore, m_ProjectStore);
+#endif
ZEN_INFO("instantiating compute services");
+#if ZEN_USE_EXEC
std::filesystem::path SandboxDir = m_DataRoot / "exec" / "sandbox";
zen::CreateDirectories(SandboxDir);
m_HttpLaunchService = std::make_unique<zen::HttpLaunchService>(*m_CasStore, SandboxDir);
+#endif
std::filesystem::path ApplySandboxDir = m_DataRoot / "exec" / "apply";
zen::CreateDirectories(ApplySandboxDir);
@@ -226,10 +234,12 @@ public:
m_Http->RegisterService(*m_StructuredCacheService);
}
+#if ZEN_USE_EXEC
if (m_HttpLaunchService)
{
m_Http->RegisterService(*m_HttpLaunchService);
}
+#endif
if (m_HttpFunctionService)
{
@@ -382,6 +392,16 @@ public:
NiceByteRate(Ctx.ScrubbedBytes(), ElapsedTimeMs));
}
+ void CollectGarbage()
+ {
+ Stopwatch Timer;
+ ZEN_INFO("Garbage collection STARTING");
+
+ m_Gc.CollectGarbage();
+
+ ZEN_INFO("Garbage collection DONE after {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
+ }
+
void Flush()
{
if (m_CasStore)
@@ -443,16 +463,14 @@ private:
zen::HttpStatusService m_StatusService;
zen::HttpStatsService m_StatsService;
std::unique_ptr<zen::CasStore> m_CasStore{zen::CreateCasStore()};
+ zen::CasGc m_Gc{*m_CasStore};
std::unique_ptr<zen::CidStore> m_CidStore;
std::unique_ptr<zen::ZenCacheStore> m_CacheStore;
- zen::CasGc m_Gc{*m_CasStore};
zen::CasScrubber m_Scrubber{*m_CasStore};
zen::HttpTestService m_TestService;
zen::HttpTestingService m_TestingService;
zen::HttpCasService m_CasService{*m_CasStore};
zen::RefPtr<zen::ProjectStore> m_ProjectStore;
- zen::Ref<zen::LocalProjectService> m_LocalProjectService;
- std::unique_ptr<zen::HttpLaunchService> m_HttpLaunchService;
std::unique_ptr<zen::HttpProjectService> m_HttpProjectService;
std::unique_ptr<zen::HttpStructuredCacheService> m_StructuredCacheService;
zen::HttpAdminService m_AdminService;
@@ -461,6 +479,14 @@ private:
std::unique_ptr<zen::HttpFunctionService> m_HttpFunctionService;
std::unique_ptr<zen::HttpFrontendService> m_FrontendService;
+#if ZEN_USE_EXEC
+ std::unique_ptr<zen::HttpLaunchService> m_HttpLaunchService;
+#endif
+
+#if ZEN_USE_NAMED_PIPES
+ zen::Ref<zen::LocalProjectService> m_LocalProjectService;
+#endif
+
bool m_DebugOptionForcedCrash = false;
};
@@ -471,7 +497,7 @@ ZenServer::InitializeStructuredCache(ZenServiceConfig& ServiceConfig)
auto ValueOrDefault = [](std::string_view Value, std::string_view Default) { return Value.empty() ? Default : Value; };
ZEN_INFO("instantiating structured cache service");
- m_CacheStore = std::make_unique<ZenCacheStore>(*m_CasStore, m_DataRoot / "cache");
+ m_CacheStore = std::make_unique<ZenCacheStore>(m_Gc, m_DataRoot / "cache");
std::unique_ptr<zen::UpstreamCache> UpstreamCache;
if (ServiceConfig.UpstreamCacheConfig.CachePolicy != UpstreamCachePolicy::Disabled)