Skip to content

Commit 72c2889

Browse files
authored
[feature](cloud) Implement file cache microbench (#47563)
Implement a microbenchmark to quickly and efficiently identify issues with the Doris file cache, including performance problems. Direct end-to-end system tests that stress Doris to evaluate the efficiency of the file cache component are relatively ineffective, as they do not quickly yield the desired eviction rates and pressures, and may also be affected by factors such as compaction. Therefore, we need to implement direct testing of the file cache functionality and performance through the IO layer (S3FileWriter + CachedRemoteReader) during upload and download operations.
1 parent ba3d0c7 commit 72c2889

9 files changed

+2737
-42
lines changed

be/CMakeLists.txt

+10
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ if (DISPLAY_BUILD_TIME)
8686
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "time -f 'TimeUsage: real=%es, user=%Us, sys=%Ss'")
8787
endif()
8888

89+
if (BUILD_FILE_CACHE_MICROBENCH_TOOL)
90+
add_definitions(-DBE_TEST)
91+
add_definitions(-DBE_BENCHMARK)
92+
endif()
93+
8994
message(STATUS "GLIBC_COMPATIBILITY is ${GLIBC_COMPATIBILITY}")
9095
message(STATUS "USE_LIBCPP is ${USE_LIBCPP}")
9196
message(STATUS "USE_MEM_TRACKER is ${USE_MEM_TRACKER}")
@@ -786,6 +791,11 @@ if (BUILD_META_TOOL)
786791
add_subdirectory(${SRC_DIR}/tools)
787792
endif()
788793

794+
option(BUILD_FILE_CACHE_MICROBENCH_TOOL "Build file cache mirobench Tool" OFF)
795+
if (BUILD_FILE_CACHE_MICROBENCH_TOOL)
796+
add_subdirectory(${SRC_DIR}/io/tools)
797+
endif()
798+
789799
option(BUILD_INDEX_TOOL "Build index tool" OFF)
790800
if (BUILD_INDEX_TOOL)
791801
add_subdirectory(${SRC_DIR}/index-tools)

be/src/io/tools/CMakeLists.txt

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# where to put generated libraries
19+
set(LIBRARY_OUTPUT_PATH "${BUILD_DIR}/src/tools")
20+
21+
# where to put generated binaries
22+
set(EXECUTABLE_OUTPUT_PATH "${BUILD_DIR}/src/tools")
23+
24+
# 编译proto文件
25+
execute_process(
26+
COMMAND make clean -C ${CMAKE_CURRENT_SOURCE_DIR}/proto
27+
RESULT_VARIABLE CLEAN_RESULT
28+
)
29+
30+
execute_process(
31+
COMMAND make -C ${CMAKE_CURRENT_SOURCE_DIR}/proto
32+
RESULT_VARIABLE MAKE_RESULT
33+
)
34+
35+
if(NOT ${MAKE_RESULT} EQUAL 0)
36+
message(FATAL_ERROR "Failed to compile proto files")
37+
endif()
38+
39+
# 打印当前源代码目录
40+
message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
41+
42+
# 查找生成的proto文件
43+
file(GLOB PROTO_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/build/proto/*.pb.cc")
44+
file(GLOB PROTO_HDRS "${CMAKE_CURRENT_SOURCE_DIR}/build/proto/*.pb.h")
45+
46+
# 打印PROTO_SRCS和PROTO_HDRS
47+
message(STATUS "PROTO_SRCS: ${PROTO_SRCS}")
48+
message(STATUS "PROTO_HDRS: ${PROTO_HDRS}")
49+
50+
# 添加 file_cache_microbench 可执行文件
51+
add_executable(file_cache_microbench
52+
file_cache_microbench.cpp
53+
${PROTO_SRCS}
54+
)
55+
56+
# 添加proto生成文件的包含路径
57+
target_include_directories(file_cache_microbench PRIVATE
58+
${CMAKE_CURRENT_SOURCE_DIR}/build/proto
59+
)
60+
61+
# 链接所需的库
62+
target_link_libraries(file_cache_microbench
63+
${DORIS_LINK_LIBS}
64+
protobuf
65+
)
66+
67+
# 安装规则
68+
install(TARGETS file_cache_microbench DESTINATION ${OUTPUT_DIR}/lib/)

be/src/io/tools/Makefile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# This file is to make all generated file needed by fe and be.
19+
20+
BUILD_DIR = ${CURDIR}/build/
21+
22+
all: subdirs
23+
.PHONY: all
24+
25+
# build all subdir
26+
SUBDIR = script proto thrift
27+
subdirs: ${SUBDIR}
28+
.PHONY: subdirs ${SUBDIR}
29+
${SUBDIR}:
30+
$(MAKE) -C $@
31+
# script will product new thrift file.
32+
thrift: script
33+
34+
clean:
35+
rm -rf ${BUILD_DIR}
36+
.PHONY: clean

0 commit comments

Comments
 (0)