diff options
| author | Dan Engelbrecht <[email protected]> | 2024-08-22 16:03:01 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-08-22 16:03:01 +0200 |
| commit | 203d3f03f0d0ef51f414b5344462bde0a8fcaf1b (patch) | |
| tree | 2d0cbe07dbf6b2d81a91e15c823ea0209205b39c /src/zenutil/include | |
| parent | safer calls to IsProcessRunning (#131) (diff) | |
| download | zen-203d3f03f0d0ef51f414b5344462bde0a8fcaf1b.tar.xz zen-203d3f03f0d0ef51f414b5344462bde0a8fcaf1b.zip | |
separate worker pools into burst/background to avoid background jobs blocking client requests (#134)
Diffstat (limited to 'src/zenutil/include')
| -rw-r--r-- | src/zenutil/include/zenutil/workerpools.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/zenutil/include/zenutil/workerpools.h b/src/zenutil/include/zenutil/workerpools.h index 78a8e5c5e..9683ad720 100644 --- a/src/zenutil/include/zenutil/workerpools.h +++ b/src/zenutil/include/zenutil/workerpools.h @@ -6,14 +6,20 @@ namespace zen { +enum class EWorkloadType +{ + Burst, // Used when you want to respond quickly, such as requests from a client + Background // Used for background jobs such as GC/Scrub/oplog import-export +}; + // Worker pool with std::thread::hardware_concurrency() worker threads, but at least one thread -WorkerThreadPool& GetLargeWorkerPool(); +WorkerThreadPool& GetLargeWorkerPool(EWorkloadType WorkloadType); // Worker pool with std::thread::hardware_concurrency() / 4 worker threads, but at least one thread -WorkerThreadPool& GetMediumWorkerPool(); +WorkerThreadPool& GetMediumWorkerPool(EWorkloadType WorkloadType); // Worker pool with std::thread::hardware_concurrency() / 8 worker threads, but at least one thread -WorkerThreadPool& GetSmallWorkerPool(); +WorkerThreadPool& GetSmallWorkerPool(EWorkloadType WorkloadType); // Special worker pool that does not use worker thread but issues all scheduled work on the calling thread // This is useful for debugging when multiple async thread can make stepping in debugger complicated |