Skip to content
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
1 change: 1 addition & 0 deletions be/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,7 @@ endif()
option(BUILD_FILE_CACHE_MICROBENCH_TOOL "Build file cache mirobench Tool" OFF)
if (BUILD_FILE_CACHE_MICROBENCH_TOOL)
add_subdirectory(${SRC_DIR}/io/tools)
add_subdirectory(${SRC_DIR}/io/cache/benchmark)
install(FILES
${BASE_DIR}/../bin/start_file_cache_microbench.sh
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
Expand Down
25 changes: 24 additions & 1 deletion be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,11 @@ DEFINE_Validator(variant_storage_parse_mode,

// block file cache
DEFINE_Bool(enable_file_cache, "false");
// ATTENTION: For test only. Keep this enabled in production.
// Whether S3 storage write paths populate file cache while writing data to object storage.
// Disable this for tests that need load and compaction output to bypass file cache while keeping
// query-side file cache writes enabled.
DEFINE_mBool(enable_file_cache_write_from_s3_file_writer, "true");
// format: [{"path":"/path/to/file_cache","total_size":21474836480,"query_limit":10737418240}]
// format: [{"path":"/path/to/file_cache","total_size":21474836480,"query_limit":10737418240},{"path":"/path/to/file_cache2","total_size":21474836480,"query_limit":10737418240}]
// format: {"path": "/path/to/file_cache", "total_size":53687091200, "ttl_percent":50, "normal_percent":40, "disposable_percent":5, "index_percent":5}
Expand Down Expand Up @@ -1289,6 +1294,22 @@ DEFINE_mBool(file_cache_enable_only_warm_up_idx, "false");
DEFINE_Int32(file_cache_downloader_thread_num_min, "32");
DEFINE_Int32(file_cache_downloader_thread_num_max, "32");

// async file cache write
DEFINE_mBool(enable_async_file_cache_write, "false");
DEFINE_mInt32(async_file_cache_write_workers_per_disk, "16");
// A positive value is the BE-wide queued+active task ownership limit. The successfully initialized
// cache instances receive equal shares. -1 selects max(1 GiB, 1% of the BE memory limit) before
// that split.
DEFINE_mInt64(async_file_cache_write_max_pending_bytes, "-1");
DEFINE_mBool(enable_async_file_cache_write_inflight_write_buffer_index, "true");
DEFINE_Int32(async_file_cache_write_inflight_write_buffer_index_shard_count, "64");
DEFINE_Validator(async_file_cache_write_workers_per_disk,
[](int32_t value) { return value > 0 && value <= 128; });
DEFINE_Validator(async_file_cache_write_max_pending_bytes,
[](int64_t value) { return value == -1 || value > 0; });
DEFINE_Validator(async_file_cache_write_inflight_write_buffer_index_shard_count,
[](int32_t value) { return value > 0; });

DEFINE_mInt32(index_cache_entry_stay_time_after_lookup_s, "1800");
DEFINE_mInt32(inverted_index_cache_stale_sweep_time_sec, "600");
DEFINE_mBool(enable_write_index_searcher_cache, "false");
Expand Down Expand Up @@ -1341,6 +1362,8 @@ DEFINE_mInt64(s3_write_buffer_size, "5242880");
// Log interval when doing s3 upload task
DEFINE_mInt32(s3_file_writer_log_interval_second, "60");
DEFINE_mInt64(file_cache_max_file_reader_cache_size, "1000000");
// When file cache is enabled, the configured bytes must be divisible by
// file_cache_each_block_size so every non-EOF HDFS cache block is canonical.
DEFINE_mInt64(hdfs_write_batch_buffer_size_mb, "1"); // 1MB

//disable shrink memory by default
Expand Down Expand Up @@ -2210,6 +2233,7 @@ bool init(const char* conf_file, bool fill_conf_map, bool must_exist, bool set_t
} \
TYPE& ref_conf_value = *reinterpret_cast<TYPE*>((FIELD).storage); \
TYPE old_value = ref_conf_value; \
ref_conf_value = new_value; \
if (RegisterConfValidator::_s_field_validator != nullptr) { \
auto validator = RegisterConfValidator::_s_field_validator->find((FIELD).name); \
if (validator != RegisterConfValidator::_s_field_validator->end() && \
Expand All @@ -2219,7 +2243,6 @@ bool init(const char* conf_file, bool fill_conf_map, bool must_exist, bool set_t
(FIELD).name, new_value); \
} \
} \
ref_conf_value = new_value; \
if (full_conf_map != nullptr) { \
std::ostringstream oss; \
oss << new_value; \
Expand Down
8 changes: 8 additions & 0 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,7 @@ DECLARE_Int32(blocking_pipeline_executor_size);

// block file cache
DECLARE_Bool(enable_file_cache);
DECLARE_mBool(enable_file_cache_write_from_s3_file_writer);
// format: [{"path":"/path/to/file_cache","total_size":21474836480,"query_limit":10737418240}]
// format: [{"path":"/path/to/file_cache","total_size":21474836480,"query_limit":10737418240},{"path":"/path/to/file_cache2","total_size":21474836480,"query_limit":10737418240}]
// format: [{"path":"/path/to/file_cache","total_size":21474836480,"query_limit":10737418240, "ttl_percent":50, "normal_percent":40, "disposable_percent":5, "index_percent":5}]
Expand Down Expand Up @@ -1328,6 +1329,13 @@ DECLARE_mBool(enable_evaluate_shadow_queue_diff);

DECLARE_mBool(file_cache_enable_only_warm_up_idx);

// async file cache write
DECLARE_mBool(enable_async_file_cache_write);
DECLARE_mInt32(async_file_cache_write_workers_per_disk);
DECLARE_mInt64(async_file_cache_write_max_pending_bytes);
DECLARE_mBool(enable_async_file_cache_write_inflight_write_buffer_index);
DECLARE_Int32(async_file_cache_write_inflight_write_buffer_index_shard_count);

// inverted index searcher cache
// cache entry stay time after lookup
DECLARE_mInt32(index_cache_entry_stay_time_after_lookup_s);
Expand Down
9 changes: 8 additions & 1 deletion be/src/exec/scan/olap_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,14 @@ static bool has_file_cache_statistics(const io::FileCacheStatistics& stats) {
stats.write_cache_io_timer != 0 || stats.bytes_write_into_cache != 0 ||
stats.num_skip_cache_io_total != 0 || stats.read_cache_file_directly_timer != 0 ||
stats.cache_get_or_set_timer != 0 || stats.lock_wait_timer != 0 ||
stats.get_timer != 0 || stats.set_timer != 0 ||
stats.get_timer != 0 || stats.set_timer != 0 || stats.async_cache_write_submitted != 0 ||
stats.async_cache_write_rejected != 0 ||
stats.async_cache_write_buffer_alloc_fail != 0 ||
stats.async_cache_write_drop_stale_epoch != 0 ||
stats.inflight_write_buffer_index_hit != 0 ||
stats.inflight_write_buffer_index_miss != 0 || stats.probe_downloaded_hit != 0 ||
stats.probe_downloading_hit != 0 || stats.probe_miss != 0 ||
stats.block_wait_success != 0 || stats.block_wait_timeout != 0 ||
stats.inverted_index_num_local_io_total != 0 ||
stats.inverted_index_num_remote_io_total != 0 ||
stats.inverted_index_num_peer_io_total != 0 ||
Expand Down
4 changes: 4 additions & 0 deletions be/src/io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ if(ENABLE_TDE)
endif()

list(REMOVE_ITEM IO_FILES "${CMAKE_CURRENT_SOURCE_DIR}/fs/benchmark/fs_benchmark_tool.cpp")
# Standalone tool with its own main(); must not be an archive member of libIO.a,
# otherwise it can be linked into the main BE binary through libIO.a.
list(REMOVE_ITEM IO_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/cache/benchmark/async_file_cache_write_microbench.cpp")

add_library(IO STATIC ${IO_FILES})

Expand Down
Loading
Loading