-
Notifications
You must be signed in to change notification settings - Fork 49
feat(benchmark): add append/pk table benchmark #302
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
Open
lucasfang
wants to merge
7
commits into
alibaba:main
Choose a base branch
from
lucasfang:benchmark
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,993
−13
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # Copyright 2026-present Alibaba Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| if(NOT PAIMON_BUILD_BENCHMARKS AND NOT PAIMON_BUILD_TESTS) | ||
| return() | ||
| endif() | ||
|
|
||
| find_package(Threads REQUIRED) | ||
|
|
||
| set(PAIMON_BENCHMARK_STATIC_LINK_LIBS | ||
| paimon_shared ${PAIMON_LOCAL_FILE_SYSTEM_SHARED_LINK_LIBS} | ||
| ${PAIMON_PARQUET_FILE_FORMAT_STATIC_LINK_LIBS} | ||
| ${PAIMON_BLOB_FILE_FORMAT_STATIC_LINK_LIBS}) | ||
|
|
||
| if(PAIMON_ENABLE_ORC) | ||
| list(APPEND PAIMON_BENCHMARK_STATIC_LINK_LIBS | ||
| ${PAIMON_ORC_FILE_FORMAT_STATIC_LINK_LIBS}) | ||
| endif() | ||
|
|
||
| if(PAIMON_ENABLE_AVRO) | ||
| list(APPEND PAIMON_BENCHMARK_STATIC_LINK_LIBS | ||
| ${PAIMON_AVRO_FILE_FORMAT_STATIC_LINK_LIBS}) | ||
| endif() | ||
|
|
||
| set(PAIMON_BENCHMARK_PLATFORM_LINK_LIBS) | ||
| if(UNIX AND NOT APPLE) | ||
| find_library(PAIMON_BENCHMARK_RT_LIBRARY rt) | ||
| if(PAIMON_BENCHMARK_RT_LIBRARY) | ||
| list(APPEND PAIMON_BENCHMARK_PLATFORM_LINK_LIBS ${PAIMON_BENCHMARK_RT_LIBRARY}) | ||
| endif() | ||
| endif() | ||
|
|
||
| if(PAIMON_BUILD_BENCHMARKS) | ||
| add_paimon_benchmark(read_write_benchmark | ||
| SOURCES | ||
| benchmark_helpers.cpp | ||
| benchmark_suite.cpp | ||
| benchmark_case_write.cpp | ||
| benchmark_case_read.cpp | ||
| benchmark_case_pk_write.cpp | ||
| benchmark_case_mor_read.cpp | ||
| read_write_benchmark.cpp | ||
| STATIC_LINK_LIBS | ||
| arrow | ||
| parquet | ||
| ${PAIMON_BENCHMARK_STATIC_LINK_LIBS} | ||
| Threads::Threads | ||
| ${CMAKE_DL_LIBS} | ||
| ${PAIMON_BENCHMARK_PLATFORM_LINK_LIBS} | ||
| ${PAIMON_BENCHMARK_LINK_TOOLCHAIN} | ||
| EXTRA_INCLUDES | ||
| ${CMAKE_SOURCE_DIR}) | ||
| endif() | ||
|
|
||
| if(PAIMON_BUILD_TESTS) | ||
| add_paimon_test(cli_option_parsing_test | ||
| SOURCES | ||
| cli_option_parsing_test.cpp | ||
| EXTRA_INCLUDES | ||
| ${CMAKE_SOURCE_DIR} | ||
| STATIC_LINK_LIBS | ||
| ${GTEST_LINK_TOOLCHAIN}) | ||
| endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * Copyright 2026-present Alibaba Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #include "benchmark/benchmark_suite.h" | ||
|
|
||
| namespace { | ||
|
|
||
| void BM_MOR_Read(::benchmark::State& state) { | ||
| paimon::benchmark::RunBMMorRead(state); | ||
| } | ||
|
|
||
| } // namespace | ||
|
|
||
| BENCHMARK(BM_MOR_Read) | ||
| ->ArgNames({"prefetch_parallel"}) | ||
| ->Unit(benchmark::kMillisecond) | ||
| ->UseRealTime() | ||
| ->Args({1}) | ||
| ->Args({2}) | ||
| ->Args({4}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * Copyright 2026-present Alibaba Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #include "benchmark/benchmark_suite.h" | ||
|
|
||
| namespace { | ||
|
|
||
| void BM_PK_Write(::benchmark::State& state) { | ||
| paimon::benchmark::RunBMPkWrite(state); | ||
| } | ||
|
|
||
| } // namespace | ||
|
|
||
| BENCHMARK(BM_PK_Write)->Unit(benchmark::kMillisecond)->UseRealTime(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * Copyright 2026-present Alibaba Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #include "benchmark/benchmark_suite.h" | ||
|
|
||
| namespace { | ||
|
|
||
| void BM_Read(::benchmark::State& state) { | ||
| paimon::benchmark::RunBMRead(state); | ||
| } | ||
|
|
||
| } // namespace | ||
|
|
||
| BENCHMARK(BM_Read) | ||
| ->ArgNames({"prefetch_parallel"}) | ||
| ->Unit(benchmark::kMillisecond) | ||
| ->UseRealTime() | ||
| ->Args({1}) | ||
| ->Args({2}) | ||
| ->Args({4}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * Copyright 2026-present Alibaba Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #include "benchmark/benchmark_suite.h" | ||
|
|
||
| namespace { | ||
|
|
||
| void BM_Write(::benchmark::State& state) { | ||
| paimon::benchmark::RunBMWrite(state); | ||
| } | ||
|
|
||
| } // namespace | ||
|
|
||
| BENCHMARK(BM_Write)->Unit(benchmark::kMillisecond)->UseRealTime(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| /* | ||
| * Copyright 2026-present Alibaba Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #include "benchmark/benchmark_helpers.h" | ||
|
|
||
| #include <iostream> | ||
|
|
||
| #include "benchmark/benchmark.h" | ||
|
|
||
| namespace paimon::benchmark { | ||
|
|
||
| bool BenchmarkHelpers::ValidateFileFormatOrSkip(::benchmark::State& state, | ||
| const std::string& file_format, bool is_supported, | ||
| SkipFn skip) { | ||
| if (!is_supported) { | ||
| skip(state, "file format is not supported in this build: " + file_format); | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| bool BenchmarkHelpers::ValidateSourcePresenceOrSkip(::benchmark::State& state, | ||
| const std::string& source_path, | ||
| const std::string& message, SkipFn skip) { | ||
| if (source_path.empty()) { | ||
| skip(state, message); | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| bool BenchmarkHelpers::ValidateSourceSupportOrSkip(::benchmark::State& state, | ||
| const std::string& source_format, | ||
| bool is_supported, SkipFn skip) { | ||
| if (!is_supported) { | ||
| skip(state, | ||
| "source data mode requires reader support in this build for format: " + source_format); | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| bool BenchmarkHelpers::ValidatePrefetchParallelOrSkip(::benchmark::State& state, | ||
| int32_t prefetch_parallel_num, SkipFn skip) { | ||
| if (prefetch_parallel_num <= 0) { | ||
| skip(state, "prefetch_parallel must be greater than 0"); | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| int64_t BenchmarkHelpers::RunReadIterations(::benchmark::State& state, | ||
| const ReadOnceFn& read_once) { | ||
| int64_t rows_read = 0; | ||
| for (auto _ : state) { | ||
| rows_read = read_once(); | ||
| } | ||
| return rows_read; | ||
| } | ||
|
|
||
| bool BenchmarkHelpers::TryRunExternalReadMode(::benchmark::State& state, | ||
| const std::string& benchmark_name, | ||
| const std::string& external_table_path, | ||
| const ReadOnceFn& read_once) { | ||
| if (external_table_path.empty()) { | ||
| return false; | ||
| } | ||
|
|
||
| std::cout << "[benchmark][" << benchmark_name << "] external_table_path=" << external_table_path | ||
| << std::endl; | ||
| const int64_t rows_read = RunReadIterations(state, read_once); | ||
| state.SetItemsProcessed(state.iterations() * rows_read); | ||
| return true; | ||
| } | ||
|
|
||
| } // namespace paimon::benchmark |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.