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](load) limit delta writer flush task parallelism #28883

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: 2 additions & 0 deletions be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,8 @@ DEFINE_mDouble(memtable_insert_memory_ratio, "1.4");
DEFINE_mInt64(write_buffer_size, "209715200");
// max buffer size used in memtable for the aggregated table, default 400MB
DEFINE_mInt64(write_buffer_size_for_agg, "419430400");
// max parallel flush task per memtable writer
DEFINE_mInt32(memtable_flush_running_count_limit, "5");

DEFINE_Int32(load_process_max_memory_limit_percent, "50"); // 50%

Expand Down
2 changes: 2 additions & 0 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,8 @@ DECLARE_mDouble(memtable_insert_memory_ratio);
DECLARE_mInt64(write_buffer_size);
// max buffer size used in memtable for the aggregated table, default 400MB
DECLARE_mInt64(write_buffer_size_for_agg);
// max parallel flush task per memtable writer
DECLARE_mInt32(memtable_flush_running_count_limit);

DECLARE_Int32(load_process_max_memory_limit_percent); // 50%

Expand Down
4 changes: 4 additions & 0 deletions be/src/olap/delta_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ Status BaseDeltaWriter::write(const vectorized::Block* block, const std::vector<
if (!_is_init && !_is_cancelled) {
RETURN_IF_ERROR(init());
}
while (_memtable_writer->get_flush_token_stats().flush_running_count >=
config::memtable_flush_running_count_limit) {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
return _memtable_writer->write(block, row_idxs, is_append);
}
Status BaseDeltaWriter::wait_flush() {
Expand Down
5 changes: 5 additions & 0 deletions be/src/olap/delta_writer_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "gutil/strings/numbers.h"
#include "io/fs/file_writer.h" // IWYU pragma: keep
#include "olap/data_dir.h"
#include "olap/memtable_flush_executor.h"
#include "olap/olap_define.h"
#include "olap/rowset/beta_rowset.h"
#include "olap/rowset/beta_rowset_writer_v2.h"
Expand Down Expand Up @@ -152,6 +153,10 @@ Status DeltaWriterV2::write(const vectorized::Block* block, const std::vector<ui
if (!_is_init && !_is_cancelled) {
RETURN_IF_ERROR(init());
}
while (_memtable_writer->get_flush_token_stats().flush_running_count >=
config::memtable_flush_running_count_limit) {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
SCOPED_RAW_TIMER(&_write_memtable_time);
return _memtable_writer->write(block, row_idxs, is_append);
}
Expand Down
Loading