Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve](move-memtable) tweak load stream flush token num and max tasks #28884

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ DEFINE_Int32(load_stream_messages_in_batch, "128");
// brpc streaming StreamWait seconds on EAGAIN
DEFINE_Int32(load_stream_eagain_wait_seconds, "60");
// max tasks per flush token in load stream
DEFINE_Int32(load_stream_flush_token_max_tasks, "2");
DEFINE_Int32(load_stream_flush_token_max_tasks, "5");

// max send batch parallelism for OlapTableSink
// The value set by the user for send_batch_parallelism is not allowed to exceed max_send_batch_parallelism_per_job,
Expand Down
5 changes: 1 addition & 4 deletions be/src/runtime/load_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ namespace doris {
TabletStream::TabletStream(PUniqueId load_id, int64_t id, int64_t txn_id,
LoadStreamMgr* load_stream_mgr, RuntimeProfile* profile)
: _id(id), _next_segid(0), _load_id(load_id), _txn_id(txn_id) {
for (int i = 0; i < 10; i++) {
_flush_tokens.emplace_back(load_stream_mgr->new_token());
}

load_stream_mgr->create_tokens(_flush_tokens);
_failed_st = std::make_shared<Status>();
_profile = profile->create_child(fmt::format("TabletStream {}", id), true, true);
_append_data_timer = ADD_TIMER(_profile, "AppendDataTime");
Expand Down
4 changes: 3 additions & 1 deletion be/src/runtime/load_stream_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ namespace doris {

LoadStreamMgr::LoadStreamMgr(uint32_t segment_file_writer_thread_num,
FifoThreadPool* heavy_work_pool, FifoThreadPool* light_work_pool)
: _heavy_work_pool(heavy_work_pool), _light_work_pool(light_work_pool) {
: _num_threads(segment_file_writer_thread_num),
_heavy_work_pool(heavy_work_pool),
_light_work_pool(light_work_pool) {
static_cast<void>(ThreadPoolBuilder("SegmentFileWriterThreadPool")
.set_min_threads(segment_file_writer_thread_num)
.set_max_threads(segment_file_writer_thread_num)
Expand Down
9 changes: 7 additions & 2 deletions be/src/runtime/load_stream_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ class LoadStreamMgr {
Status open_load_stream(const POpenLoadStreamRequest* request,
LoadStreamSharedPtr& load_stream);
void clear_load(UniqueId loadid);
std::unique_ptr<ThreadPoolToken> new_token() {
return _file_writer_thread_pool->new_token(ThreadPool::ExecutionMode::SERIAL);
void create_tokens(std::vector<std::unique_ptr<ThreadPoolToken>>& tokens) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: method 'create_tokens' can be made const [readability-make-member-function-const]

Suggested change
void create_tokens(std::vector<std::unique_ptr<ThreadPoolToken>>& tokens) {
void create_tokens(std::vector<std::unique_ptr<ThreadPoolToken>>& tokens) const {

for (int i = 0; i < _num_threads * 2; i++) {
tokens.push_back(
_file_writer_thread_pool->new_token(ThreadPool::ExecutionMode::SERIAL));
}
}

// only used by ut
Expand All @@ -56,6 +59,8 @@ class LoadStreamMgr {
std::unordered_map<UniqueId, LoadStreamSharedPtr> _load_streams_map;
std::unique_ptr<ThreadPool> _file_writer_thread_pool;

uint32_t _num_threads = 0;

FifoThreadPool* _heavy_work_pool = nullptr;
FifoThreadPool* _light_work_pool = nullptr;
};
Expand Down
Loading