Skip to content

Commit

Permalink
[enhancement](exchange) not use thread pool to handle exchange block (a…
Browse files Browse the repository at this point in the history
…pache#23970)

Co-authored-by: yiguolei <yiguolei@gmail.com>
  • Loading branch information
yiguolei and Doris-Extras authored Sep 7, 2023
1 parent 20b3e5e commit f2ebe65
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions be/src/service/internal_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1100,20 +1100,10 @@ void PInternalServiceImpl::transmit_block(google::protobuf::RpcController* contr
int64_t receive_time = GetCurrentTimeNanos();
response->set_receive_time(receive_time);

if (!request->has_block() && config::brpc_light_work_pool_threads == -1) {
// under high concurrency, thread pool will have a lot of lock contention.
_transmit_block(controller, request, response, done, Status::OK());
return;
}

FifoThreadPool& pool = request->has_block() ? _heavy_work_pool : _light_work_pool;
bool ret = pool.try_offer([this, controller, request, response, done]() {
_transmit_block(controller, request, response, done, Status::OK());
});
if (!ret) {
offer_failed(response, done, pool);
return;
}
// under high concurrency, thread pool will have a lot of lock contention.
// May offer failed to the thread pool, so that we should avoid using thread
// pool here.
_transmit_block(controller, request, response, done, Status::OK());
}

void PInternalServiceImpl::transmit_block_by_http(google::protobuf::RpcController* controller,
Expand Down

0 comments on commit f2ebe65

Please sign in to comment.