diff options
Diffstat (limited to 'src/zenstore')
| -rw-r--r-- | src/zenstore/cas.cpp | 3 | ||||
| -rw-r--r-- | src/zenstore/gc.cpp | 14 |
2 files changed, 6 insertions, 11 deletions
diff --git a/src/zenstore/cas.cpp b/src/zenstore/cas.cpp index c6bfda8b9..d38099117 100644 --- a/src/zenstore/cas.cpp +++ b/src/zenstore/cas.cpp @@ -23,6 +23,7 @@ #include <zenstore/cidstore.h> #include <zenstore/gc.h> #include <zenstore/scrubcontext.h> +#include <zenutil/workerpools.h> #include <gsl/gsl-lite.hpp> @@ -106,7 +107,7 @@ CasImpl::Initialize(const CidStoreConfiguration& InConfig) // Initialize payload storage { - WorkerThreadPool WorkerPool(3, "CasImpl::Initialize"); + WorkerThreadPool& WorkerPool = GetSmallWorkerPool(); std::vector<std::future<void>> Work; Work.emplace_back( WorkerPool.EnqueueTask(std::packaged_task<void()>{[&]() { m_LargeStrategy.Initialize(m_Config.RootDirectory, IsNewStore); }})); diff --git a/src/zenstore/gc.cpp b/src/zenstore/gc.cpp index b53ca4bab..e2ab34d1e 100644 --- a/src/zenstore/gc.cpp +++ b/src/zenstore/gc.cpp @@ -18,6 +18,7 @@ #include <zencore/workthreadpool.h> #include <zenstore/cidstore.h> #include <zenstore/scrubcontext.h> +#include <zenutil/workerpools.h> #include "cas.h" @@ -610,18 +611,11 @@ GcManager::CollectGarbage(const GcSettings& Settings) RwLock::SharedLockScope GcLock(m_Lock); - int WorkerThreadPoolCount = 0; - if (!Settings.SingleThread) - { - const size_t MaxHwTreadUse = Max((std::thread::hardware_concurrency() / 4u), 1u); - WorkerThreadPoolCount = gsl::narrow<int>(Min(MaxHwTreadUse, m_GcReferencers.size())); - } - Result.ReferencerStats.resize(m_GcReferencers.size()); std::unordered_map<std::unique_ptr<GcStoreCompactor>, GcCompactStoreStats*> StoreCompactors; RwLock StoreCompactorsLock; - WorkerThreadPool ThreadPool(WorkerThreadPoolCount, "GCV2"); + WorkerThreadPool& ThreadPool = Settings.SingleThread ? GetSyncWorkerPool() : GetSmallWorkerPool(); ZEN_INFO("GCV2: Removing expired data from {} referencers", m_GcReferencers.size()); if (!m_GcReferencers.empty()) @@ -1932,8 +1926,8 @@ GcScheduler::ScrubStorage(bool DoDelete, std::chrono::seconds TimeSlice) Stopwatch Timer; ZEN_INFO("scrubbing STARTING (delete mode => {})", DoDelete); - WorkerThreadPool ThreadPool{4, "scrubber"}; - ScrubContext Ctx{ThreadPool, Deadline}; + WorkerThreadPool& ThreadPool = GetSmallWorkerPool(); + ScrubContext Ctx{ThreadPool, Deadline}; try { |