🎬No video for this question yet. The written answer is below.
A job failed due to memory issues — how would you debug and fix it?- Two large datasets need to be joined — how do you optimize performance?
- How do you handle skewed data in distributed systems?
- How do you design a scalable data pipeline in AWS?
- What are latest trends in Data Engineering (Lakehouse, Iceberg, Delta, etc.)?
📝 Answer
Interviewer:
A job failed due to memory issues — how would you debug and fix it?
Candidate:
So basically, whenever I hear memory issue, I don’t directly jump to increasing memory. First, I try to understand why memory is getting exhausted.
The first thing I would do is check logs, especially Spark UI or CloudWatch logs if it's a Glue job. That helps me identify which stage or transformation is consuming more memory.
In one of my projects, I faced a similar issue while processing a large dataset. Initially, I thought it was just a resource issue, but when I analyzed the execution plan, I found that a wide transformation like groupBy was causing a lot of data shuffle.
So first, I reduced the data size early by applying filters before heavy transformations.
Then I checked partitioning. Sometimes, too few partitions can overload executors. So I increased partitions using repartition.
Another issue I encountered was using collect(), which brings all data to the driver. I removed that and used distributed operations instead.
Also, I switched from DataFrame to more optimized operations and ensured that unnecessary columns were dropped early.
Only after doing all these, if needed, I increased executor memory.
So basically, my approach is… identify the bottleneck, optimize transformations, reduce data size, and then tune resources.
Interviewer:
Two large datasets need to be joined — how do you optimize performance?
Candidate:
So this is a very common real-time scenario.
First, I try to understand the size of both datasets. If one dataset is small, I use broadcast join. This avoids shuffling large data.
In one of my projects, I joined transaction data with a small lookup table. Broadcasting the lookup table reduced execution time significantly.
If both datasets are large, then I focus on partitioning strategy. I make sure both datasets are partitioned on the join key.
I also filter unnecessary data before joining. This reduces the amount of data being processed.
Another thing I do is check skew. If one key has too much data, it can slow down the join.
And finally, I always check the execution plan to see if the join strategy is optimal.
So basically, optimize joins by reducing data, choosing the right join strategy, and ensuring proper partitioning.
Interviewer:
How do you handle skewed data in distributed systems?
Candidate:
So data skew is something I’ve faced multiple times.
First, I identify skew by looking at task execution time. If one task is taking much longer, it’s usually due to skew.
In one of my projects, a particular key had a huge amount of data. So one partition became very heavy.
To fix this, I used salting technique. I added a random value to the key to distribute data across partitions.
Then during join, I handled the salted keys properly.
Another approach I used is skew join optimization in Spark, where Spark automatically handles skewed partitions.
So basically, the idea is to balance data distribution across nodes.
Interviewer:
How do you design a scalable data pipeline in AWS?
Candidate:
So basically, when I design a scalable pipeline, I think in terms of decoupling and scalability.
First, data ingestion. I use services like S3, Kinesis, or API Gateway depending on the source.
Then for processing, I use Glue or Lambda for small workloads, and Spark-based processing for large datasets.
I ensure the pipeline is event-driven. For example, S3 upload triggers Lambda or Glue job.
For storage, I use S3 with proper partitioning and format like Parquet.
Then for querying, I use Athena or Redshift.
In one of my projects, I built an end-to-end pipeline where data flows from S3 → Glue → Redshift → Dashboard.
I also add monitoring using CloudWatch and alerting using SNS.
So basically, scalability comes from using serverless services, partitioning data, and decoupling components.
Interviewer:
What are the latest trends in Data Engineering like Lakehouse, Iceberg, Delta?
Candidate:
So basically, data engineering is evolving a lot, and I’ve been exploring these trends.
First, Lakehouse architecture. It combines data lake and data warehouse. So we get flexibility of data lake and performance of warehouse.
Then comes Delta Lake and Iceberg.
In my understanding, these are table formats that bring features like ACID transactions, schema evolution, and time travel to data lakes.
In one of my learning projects, I used Delta Lake to handle incremental updates and maintain version history.
These formats solve a major problem in traditional data lakes, which is lack of reliability.
So basically, the trend is moving towards unified data platforms where storage and analytics are tightly integrated.
Interviewer (Follow-up):
That’s great. Can you explain how Delta Lake handles ACID transactions internally?