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

[EPIC] Improve performance of TPC-H queries #391

Open
2 of 14 tasks
andygrove opened this issue May 6, 2024 · 10 comments
Open
2 of 14 tasks

[EPIC] Improve performance of TPC-H queries #391

andygrove opened this issue May 6, 2024 · 10 comments
Labels
enhancement New feature or request performance

Comments

@andygrove
Copy link
Member

andygrove commented May 6, 2024

What is the problem the feature request solves?

This epic is for tracking progress on improving performance of Comet with our benchmarks derived from TPC-H.

Current status (September 2024)

  • Comet is 1.6x faster than Spark
  • Comet is not as fast as other DataFusion subprojects yet
  • All of these DataFusion subprojects are performing similar native execution, which indicates that there is room to improve on Comet's current performance
Screenshot 2024-09-20 at 10 08 15 AM

Features needed to support all queries natively

We do not run all queries fully natively yet due to these missing features:

Planned features that could help in general

Issues that affect multiple queries

  • Scans are sometimes slower due to dictionary encoding or decoding, and it may be better if we can defer this until later in the query, but this is not really possible at the moment because DataFusion requires that all batches with a stream have the same physical type, so we cannot match Utf and Dictionary for example
  • CometExchange is sometimes slower than Spark's exchange even though it reads and writes less data.

Per-Query Tracking

Most of these queries are already faster with Comet enabled. Here are notes on areas where performance could potentially be improved.

@andygrove andygrove added the enhancement New feature or request label May 6, 2024
@viirya
Copy link
Member

viirya commented May 6, 2024

BroadcastExchange should be supported, I think. We have CometBroadcastExchange.

We don't need to support AQEShuffleRead. It is a shuffle reader wrapper in Spark. It calls wrapped shuffle's execute or executeColumnar depending on it is columnar or not.

@viirya
Copy link
Member

viirya commented May 6, 2024

We don't need to support Execute CreateViewCommand too. It is a command exec operator.

@viirya
Copy link
Member

viirya commented May 6, 2024

Also CommandResult, which is only used to hold data from a command. CommandResult and Execute CreateViewCommand are not query execution operators.

@andygrove
Copy link
Member Author

Also CommandResult, which is only used to hold data from a command. CommandResult and Execute CreateViewCommand are not query execution operators.

Thanks. I saw those from the CREATE VIEW in q15 but I see from the Spark UI that the SELECT part of this query is already fully native. I have removed those from the list.

@andygrove
Copy link
Member Author

BroadcastExchange should be supported, I think. We have CometBroadcastExchange.

BroadcastExchange is not supported is the information that Comet provides for q8. I think part of this epic will be making these messages more informative.

@viirya
Copy link
Member

viirya commented May 7, 2024

For Sort merge join with a join condition, I added the support to DataFusion for a while but we've not incorporated the feature in Comet yet. I opened #398 to track it and I will work on it once #250 is merged and #248 is done.

@viirya
Copy link
Member

viirya commented May 7, 2024

BroadcastExchange is not supported is the information that Comet provides for q8. I think part of this epic will be making these messages more informative.

I will take a look at q8 and see why it is not enabled there.

@andygrove
Copy link
Member Author

I will take a look at q8 and see why it is not enabled there.

The error BroadcastExchange is not supported really means BroadcastExchange is not supported because the child operators are not supported

@viirya
Copy link
Member

viirya commented May 10, 2024

Please disable spark.comet.exec.broadcast.enabled which should not be used in normal query: #408 (comment)

@andygrove andygrove added this to the 0.2.0 milestone Jul 25, 2024
@andygrove andygrove removed this from the 0.2.0 milestone Aug 16, 2024
@andygrove andygrove changed the title [EPIC] Support native execution for all TPC-H queries [EPIC] Improve performance of TPC-H queries Sep 20, 2024
@mbutrovich
Copy link
Contributor

I ran TPC-H locally and profiled the sole executor with 4 CPU cores allocated to it. One thing I noticed is that update_comet_metric is taking 3.2% of the time. Within Native_executePlan it accounts for ~7-8% of an individual worker's CPU time in Comet.

I want to look at the granularity that these operations occur at, and see if we can coalesce metrics on the native side and maybe ship more at once to reduce the JNI overhead. I want to add more metrics to Comet to understand where we're spending time, but the overhead is going to add up.

tpch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance
Projects
None yet
Development

No branches or pull requests

3 participants