🔥 Spark Interview Problem 🔥
Q: Your Spark job processes 10 TB of Parquet data daily but takes 4 hours. 80% of execution time is spent in a single wide transformation. How do you diagnose and optimize it?
Asked at: Netflix | Databricks | Uber
Difficulty: Hard
Answer
Start by checking the Spark UI for the slow stage — look at shuffle read/write bytes, spill metrics, and task duration variance. 80% in one stage usually means data skew or an expensive shuffle.
Key optimization steps:
Steps:
Check if partition count is adequate — spark.sql.shuffle.partitions default 200 is too low for 10 TB; set to 2000-4000.
Use .explain() to verify the physical plan — look for BroadcastHashJoin vs SortMergeJoin.
Enable AQE (spark.sql.adaptive.enabled=true) to auto-coalesce small partitions and handle skew.
If Parquet columns are selectively read, verify predicate pushdown is happening.
Check for UDFs that block Catalyst optimization — replace with built-in functions.
Config:
spark.conf.set(
"spark.sql.adaptive.enabled", "true"
)
spark.conf.set(
"spark.sql.adaptive.skewJoin.enabled", "true"
)
spark.conf.set(
"spark.sql.shuffle.partitions", "3000"
)
df.explain(mode="cost")
Interview tip: Always check spill-to-disk metrics first. They indicate memory pressure and can help identify expensive stages.
#Spark #PySpark #DataEngineering #BigData #InterviewPrep
I have never expected accountability or sensitivity from the government in any branch be it Education, Health or basic things however this is another level of arrogance.
When govt sees everything with lense of haar jeet this is what will happen.
Also, we are playing bilateral mostly on 230-240 roads nowadays. This was bound to happen once.
This T20WC has been really good in terms of the competitive pitches throughout the tournament.
Same old election is rigged rhetoric. 🤦♂️
Why can’t the Congress party accept a loss gracefully?
Your alliance is leading(winning) in Jammu and Kashmir but you’re stuck with this rhetoric.
@ParivahanSewa it’s been 3 months since I have applied for Learning License but it is still in “Printing Pending” state. I can’t apply for DL due to this issue. Please help asap as I tired of this highly inefficient system.
#ParivahanSewa#driving#sarathi#license
@srijann25 @aryankaushik_ @official_dda Exactly , @OfficialSdmc@official_dda should look into the matter . It is very shocking and disheartening that children are being kept away from enjoying sports .
There are so many DDA and SDMC parks/grounds but we aren’t allowed to play.
We play cricket and some caretaker comes to stop us from playing. Why are most parks only for walking/yoga purposes? Why can’t you let us play in some of the parks.
@aryankaushik_ @official_dda
@OfficialSdmc Dwarka Sector 22 , kids are not allowed to play sports in any of the park in sector 22 , this is absolutely shameful .You built hundreds of open gyms but there is no benefit if facilities of sports are not there . Open gyms are useless if there is no play area .