diff --git a/src/net/include/thread_pool.h b/src/net/include/thread_pool.h index fed8f42ddb..8d20957194 100644 --- a/src/net/include/thread_pool.h +++ b/src/net/include/thread_pool.h @@ -113,7 +113,7 @@ class ThreadPool : public pstd::noncopyable { uint16_t task_idx_; - const uint8_t nworkers_per_link_ = 2; // numer of workers per link + const uint8_t nworkers_per_link_ = 1; // numer of workers per link const uint8_t nlinks_; // number of links (upper around) std::vector> newest_node_; std::atomic node_cnt_; // for task diff --git a/src/net/src/thread_pool.cc b/src/net/src/thread_pool.cc index 5f067b1148..c37f08df15 100644 --- a/src/net/src/thread_pool.cc +++ b/src/net/src/thread_pool.cc @@ -52,7 +52,7 @@ ThreadPool::ThreadPool(size_t worker_num, size_t max_queue_size, std::string thr node_cnt_(0), time_newest_node_(nlinks_), time_node_cnt_(0), - queue_slow_size_(std::min(worker_num * 10, max_queue_size)), + queue_slow_size_(std::max(10UL, std::min(worker_num * max_queue_size / 100, max_queue_size))), max_queue_size_(max_queue_size), max_yield_usec_(100), slow_yield_usec_(3),