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

optimize: speed up stat gen by factor x15 #167

Merged
merged 16 commits into from
Apr 30, 2024
Merged

optimize: speed up stat gen by factor x15 #167

merged 16 commits into from
Apr 30, 2024

Conversation

AlSchlo
Copy link
Contributor

@AlSchlo AlSchlo commented Apr 24, 2024

Made the stat generation faster using Rayon's thread pool.

Various improvements, such as;

  • slightly less copying
  • optimized MG
  • process in parallel using Rayon, taking advantage of fold/reduce
  • moved to Parquet (WIP to convert into Parquet automatically)
  • read Parquet in parallel (one reader for each row-group), this granularity is sufficient for big enough datasets

This takes 30s for JOB 1D stats on my computer, vs 7:30min before.
Postgres takes 1:30min loading, and 22s for the stat gen. So we beat it, depending on how we view it.

On "real" datacenter hardware (i.e. 512 cores), we would crush it, we'll test that soon.

Finally coming together :-)

@AlSchlo AlSchlo changed the title optimize: speed up stat gen by factor x2 optimize: speed up stat gen by factor x8 Apr 29, 2024
@AlSchlo AlSchlo changed the title optimize: speed up stat gen by factor x8 optimize: speed up stat gen by factor x10 Apr 29, 2024
Copy link
Member

@wangpatrick57 wangpatrick57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments about things to think about.

optd-gungnir/src/stats/misragries.rs Show resolved Hide resolved
optd-datafusion-repr/src/cost/base_cost/stats.rs Outdated Show resolved Hide resolved
Self::generate_partial_stats(&comb, mgs, hlls, null_cnts);
Ok(local_stats)
}
Err(_) => todo!(), // TODO(Alexis): Could not satisfy the type checker otherwise, but never happens!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it never happens you can panic!() here with a description in the panic for why it never happens

optd-datafusion-repr/src/cost/base_cost/stats.rs Outdated Show resolved Hide resolved
@@ -410,7 +414,7 @@ impl DatafusionDBMS {
&mut self,
job_kit_config: &JobKitConfig,
) -> anyhow::Result<DataFusionBaseTableStats> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're modifying get_job_stats() you should also modify get_tpch_stats() in the same way. In the future we can think about creating a trait called BenchmarkKit and making a generic function that works with any object of that trait. However, for now unfortunately there's some copied code here.

optd-perftest/src/job.rs Outdated Show resolved Hide resolved
@AlSchlo AlSchlo changed the title optimize: speed up stat gen by factor x10 optimize: speed up stat gen by factor x15 Apr 30, 2024
@AlSchlo AlSchlo merged commit 74dc3ff into main Apr 30, 2024
1 check passed
@AlSchlo AlSchlo deleted the optimize branch April 30, 2024 23:55
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