aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-08-22 16:03:01 +0200
committerGitHub Enterprise <[email protected]>2024-08-22 16:03:01 +0200
commit203d3f03f0d0ef51f414b5344462bde0a8fcaf1b (patch)
tree2d0cbe07dbf6b2d81a91e15c823ea0209205b39c /src/zenserver
parentsafer calls to IsProcessRunning (#131) (diff)
downloadzen-203d3f03f0d0ef51f414b5344462bde0a8fcaf1b.tar.xz
zen-203d3f03f0d0ef51f414b5344462bde0a8fcaf1b.zip
separate worker pools into burst/background to avoid background jobs blocking client requests (#134)
Diffstat (limited to 'src/zenserver')
-rw-r--r--src/zenserver/projectstore/projectstore.cpp4
-rw-r--r--src/zenserver/projectstore/remoteprojectstore.cpp10
-rw-r--r--src/zenserver/workspaces/httpworkspaces.cpp12
3 files changed, 14 insertions, 12 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp
index dd007c8b4..803980b2b 100644
--- a/src/zenserver/projectstore/projectstore.cpp
+++ b/src/zenserver/projectstore/projectstore.cpp
@@ -3227,7 +3227,7 @@ ProjectStore::GetProjectFiles(const std::string_view ProjectId,
}
return true;
},
- &GetSmallWorkerPool());
+ &GetSmallWorkerPool(EWorkloadType::Burst));
}
CbObjectWriter Response;
@@ -3323,7 +3323,7 @@ ProjectStore::GetProjectChunkInfos(const std::string_view ProjectId,
Sizes.resize(Hashes.size(), 0u);
}
- WorkerThreadPool& WorkerPool = GetSmallWorkerPool(); // GetSyncWorkerPool();
+ WorkerThreadPool& WorkerPool = GetSmallWorkerPool(EWorkloadType::Burst); // GetSyncWorkerPool();
(void)FoundLog->IterateChunks(
Hashes,
[&](size_t Index, const IoBuffer& Chunk) -> bool {
diff --git a/src/zenserver/projectstore/remoteprojectstore.cpp b/src/zenserver/projectstore/remoteprojectstore.cpp
index 15d329442..ab31d5ec5 100644
--- a/src/zenserver/projectstore/remoteprojectstore.cpp
+++ b/src/zenserver/projectstore/remoteprojectstore.cpp
@@ -1418,7 +1418,7 @@ BuildContainer(CidStore& ChunkStore,
const std::function<void(std::vector<std::pair<IoHash, FetchChunkFunc>>&&)>& OnBlockChunks,
bool EmbedLooseFiles)
{
- WorkerThreadPool& WorkerPool = GetLargeWorkerPool();
+ WorkerThreadPool& WorkerPool = GetLargeWorkerPool(EWorkloadType::Background);
AsyncRemoteResult RemoteResult;
CbObject ContainerObject = BuildContainer(ChunkStore,
@@ -1777,8 +1777,8 @@ SaveOplog(CidStore& ChunkStore,
UploadInfo Info;
- WorkerThreadPool& WorkerPool = GetLargeWorkerPool();
- WorkerThreadPool& NetworkWorkerPool = GetMediumWorkerPool();
+ WorkerThreadPool& WorkerPool = GetLargeWorkerPool(EWorkloadType::Background);
+ WorkerThreadPool& NetworkWorkerPool = GetMediumWorkerPool(EWorkloadType::Background);
const RemoteProjectStore::RemoteStoreInfo RemoteStoreInfo = RemoteStore.GetInfo();
@@ -2380,8 +2380,8 @@ LoadOplog(CidStore& ChunkStore,
Stopwatch Timer;
- WorkerThreadPool& WorkerPool = GetLargeWorkerPool();
- WorkerThreadPool& NetworkWorkerPool = GetSmallWorkerPool();
+ WorkerThreadPool& WorkerPool = GetLargeWorkerPool(EWorkloadType::Background);
+ WorkerThreadPool& NetworkWorkerPool = GetSmallWorkerPool(EWorkloadType::Background);
std::unordered_set<IoHash, IoHash::Hasher> Attachments;
uint64_t BlockCountToDownload = 0;
diff --git a/src/zenserver/workspaces/httpworkspaces.cpp b/src/zenserver/workspaces/httpworkspaces.cpp
index 7242b2fba..6a4e9c466 100644
--- a/src/zenserver/workspaces/httpworkspaces.cpp
+++ b/src/zenserver/workspaces/httpworkspaces.cpp
@@ -662,7 +662,7 @@ HttpWorkspacesService::FilesRequest(HttpRouterRequest& Req, const Oid& Workspace
const bool WantsSizeField = WantsAllFields || WantedFieldNames.contains("size");
std::optional<std::vector<Workspaces::ShareFile>> Files =
- m_Workspaces.GetWorkspaceShareFiles(WorkspaceId, ShareId, Refresh, GetSmallWorkerPool());
+ m_Workspaces.GetWorkspaceShareFiles(WorkspaceId, ShareId, Refresh, GetSmallWorkerPool(EWorkloadType::Burst));
if (!Files.has_value())
{
return ServerRequest.WriteResponse(HttpResponseCode::NotFound);
@@ -706,7 +706,8 @@ void
HttpWorkspacesService::ChunkInfoRequest(HttpRouterRequest& Req, const Oid& WorkspaceId, const Oid& ShareId, const Oid& ChunkId)
{
HttpServerRequest& ServerRequest = Req.ServerRequest();
- Workspaces::ShareFile File = m_Workspaces.GetWorkspaceShareChunkInfo(WorkspaceId, ShareId, ChunkId, GetSmallWorkerPool());
+ Workspaces::ShareFile File =
+ m_Workspaces.GetWorkspaceShareChunkInfo(WorkspaceId, ShareId, ChunkId, GetSmallWorkerPool(EWorkloadType::Burst));
if (File.Id != Oid::Zero)
{
CbObjectWriter Response;
@@ -738,7 +739,8 @@ HttpWorkspacesService::BatchRequest(HttpRouterRequest& Req, const Oid& Workspace
[](const RequestChunkEntry& Entry) {
return Workspaces::ChunkRequest{.ChunkId = Entry.ChunkId, .Offset = Entry.Offset, .Size = Entry.RequestBytes};
});
- std::vector<IoBuffer> Chunks = m_Workspaces.GetWorkspaceShareChunks(WorkspaceId, ShareId, Requests, GetSmallWorkerPool());
+ std::vector<IoBuffer> Chunks =
+ m_Workspaces.GetWorkspaceShareChunks(WorkspaceId, ShareId, Requests, GetSmallWorkerPool(EWorkloadType::Burst));
if (Chunks.empty())
{
return ServerRequest.WriteResponse(HttpResponseCode::NotFound);
@@ -794,7 +796,7 @@ HttpWorkspacesService::EntriesRequest(HttpRouterRequest& Req, const Oid& Workspa
m_WorkspacesStats.WorkspaceShareEntriesReadCount++;
std::optional<std::vector<Workspaces::ShareFile>> Files =
- m_Workspaces.GetWorkspaceShareFiles(WorkspaceId, ShareId, Refresh, GetSmallWorkerPool());
+ m_Workspaces.GetWorkspaceShareFiles(WorkspaceId, ShareId, Refresh, GetSmallWorkerPool(EWorkloadType::Burst));
if (!Files.has_value())
{
return ServerRequest.WriteResponse(HttpResponseCode::NotFound);
@@ -900,7 +902,7 @@ HttpWorkspacesService::ChunkRequest(HttpRouterRequest& Req, const Oid& Workspace
WorkspaceId,
ShareId,
std::vector<Workspaces::ChunkRequest>{Workspaces::ChunkRequest{.ChunkId = ChunkId, .Offset = Offset, .Size = Size}},
- GetSmallWorkerPool());
+ GetSmallWorkerPool(EWorkloadType::Burst));
if (!Response.empty() && Response[0])
{
m_WorkspacesStats.WorkspaceShareChunkHitCount++;