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

plannertest: criterion-rs based benchmark for both planning and execution #262

Merged
merged 11 commits into from
Dec 10, 2024

Conversation

yliang412
Copy link
Member

@yliang412 yliang412 commented Dec 9, 2024

Part of #263.

Problem

There is a lack of performance evaluation in optd. Without proper benchmarking, we will not know if some changes cause significant regression in performance. We should keep track of the two aspects of optimizer performance:

  • plan generation time
  • actual execution time

Summary of changes

Planning:

  • Input: SQL statement (aka datafusion_sql::parser::Statement).
  • Measures the time it takes to generate a datafusion physical plan.

Execution:

  • Input: datafusion physical plan outputted from optd (aka Arc<dyn ExecutionPlan>).
  • Measures the time it takes to execute the entire query.

Next Steps

https://github.com/benchmark-action/github-action-benchmark can directly take cargo bench results as input. So it will be easy to set up CI.

@yliang412 yliang412 mentioned this pull request Dec 9, 2024
2 tasks
@yliang412 yliang412 force-pushed the yuchen/planner-bench branch from efec400 to 2b9c3ad Compare December 10, 2024 00:00
Signed-off-by: Yuchen Liang <[email protected]>
Signed-off-by: Yuchen Liang <[email protected]>
Signed-off-by: Yuchen Liang <[email protected]>
@yliang412
Copy link
Member Author

yliang412 commented Dec 10, 2024

Examples

# benchmark all TPC-H queries with "bench" task enabled
cargo bench --bench planner_bench tpch/
# benchmark TPC-H Q1
$ cargo bench --bench planner_bench tpch/q1/
    Finished `bench` profile [optimized] target(s) in 0.21s
     Running benches/planner_bench.rs (target/release/deps/planner_bench-978004a60630bb99)
Gnuplot not found, using plotters backend
Benchmarking tpch/q1/planning: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 6.7s, enable flat sampling, or reduce sample count to 60.
tpch/q1/planning        time:   [292.65 µs 295.24 µs 300.24 µs]
Found 12 outliers among 100 measurements (12.00%)
  4 (4.00%) high mild
  8 (8.00%) high severe

tpch/q1/execution       time:   [534.62 µs 538.27 µs 544.50 µs]
Found 12 outliers among 100 measurements (12.00%)
  3 (3.00%) high mild
  9 (9.00%) high severe
# benchmark TPC-H Q1 planning
cargo bench --bench planner_bench tpch/q1/planning

# benchmark TPC-H Q1 execution
cargo bench --bench planner_bench tpch/q1/execution

@yliang412 yliang412 marked this pull request as ready for review December 10, 2024 02:25
@yliang412 yliang412 requested a review from jurplel December 10, 2024 02:26
@skyzh
Copy link
Member

skyzh commented Dec 10, 2024

CI config not updated yet? I assume there will be a separate patch...

@yliang412
Copy link
Member Author

CI config not updated yet? I assume there will be a separate patch...

CI will be done as a separate PR.

@yliang412 yliang412 enabled auto-merge (squash) December 10, 2024 04:52
@yliang412 yliang412 merged commit cca20d4 into main Dec 10, 2024
1 check passed
@yliang412 yliang412 deleted the yuchen/planner-bench branch December 10, 2024 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants