Skip to content

Commit

Permalink
change default queue_slow_size_ and nworkers_per_link_
Browse files Browse the repository at this point in the history
  • Loading branch information
QlQlqiqi committed Jul 13, 2024
1 parent 8694da0 commit 6e6b808
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/net/include/thread_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::atomic<Node*>> newest_node_;
std::atomic<int> node_cnt_; // for task
Expand Down
2 changes: 1 addition & 1 deletion src/net/src/thread_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 6e6b808

Please sign in to comment.