Skip to content

Tuning Spark Test Performance #989

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

Merged
merged 14 commits into from
May 16, 2025
Merged
14 changes: 14 additions & 0 deletions spark/src/main/scala/ai/chronon/spark/SparkSessionBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,19 @@ object SparkSessionBuilder {
// use all threads - or the tests will be slow
.master("local[*]")
.config("spark.kryo.registrationRequired", s"${localWarehouseLocation.isEmpty}")
// ── use an in‐memory Derby metastore rather than disk + BoneCP ──
.config("spark.hadoop.javax.jdo.option.ConnectionURL", "jdbc:derby:memory:metastore_db;create=true")
.config("spark.hadoop.javax.jdo.option.ConnectionDriverName", "org.apache.derby.jdbc.EmbeddedDriver")
.config("spark.hadoop.javax.jdo.option.ConnectionUserName", "APP")
.config("spark.hadoop.javax.jdo.option.ConnectionPassword", "APP")
.config("spark.ui.enabled", "false")
.config("spark.chronon.outputParallelismOverride", "2")
.config("spark.chronon.group_by.parallelism", "2")
.config("spark.sql.shuffle.partitions", "2")
.config("spark.default.parallelism", "2")
.config("spark.testing", "true")
.config("spark.ui.enabled", false)
.config("spark.sql.adaptive.enabled", true)
.config("spark.local.dir", s"/tmp/$userName/$name")
.config("spark.sql.warehouse.dir", s"$warehouseDir/data")
.config("spark.hadoop.javax.jdo.option.ConnectionURL", metastoreDb)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the metastoreDb here need to match the in-memory one above?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or should this be removed, I guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1 Will change

Copy link
Collaborator

Choose a reason for hiding this comment

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

Expand Down Expand Up @@ -129,6 +142,7 @@ object SparkSessionBuilder {
baseBuilder
// use all threads - or the tests will be slow
.master("local[*]")
.config("spark.ui.enabled", "false")
.config("spark.local.dir", s"/tmp/$userName/chronon-spark-streaming")
.config("spark.kryo.registrationRequired", "true")
} else {
Expand Down
Loading