hardMultiple ChoiceObjective-mapped
Optimize Many Small Files in Azure Data Lake Storage Gen2
You are a data engineer for a retail company. The company uses Azure Data Lake Storage Gen2 to store raw transaction data partitioned by date. Each day, a folder is created with the format 'YYYY/MM/DD' containing thousands of small JSON files (each ~10 KB). An Azure Databricks job runs daily to read the previous day's folder, transform the data, and write to a Delta table for reporting. Over time, the job's execution time has increased from 15 minutes to over 2 hours. The job uses a cluster with 4 nodes (each 16 GB memory). Monitoring shows that the job spends most of its time in the 'listing files' stage. Which optimization should you implement to reduce the job duration?
Quick Answer
The answer is to pre-process the raw data to coalesce small JSON files into larger Parquet files, such as 256 MB each. This is correct because the job’s bottleneck is the 'listing files' stage, where Spark must enumerate thousands of tiny 10 KB JSON files in Azure Data Lake Storage Gen2, incurring excessive metadata operations. By consolidating these files into fewer, larger Parquet files, you reduce the number of file listings and leverage Parquet’s columnar format for faster reads, directly addressing the root cause of the slowdown. On the DP-203 exam, this scenario tests your understanding of file size optimization in Azure Data Lake Storage Gen2 with Databricks, a common pitfall where candidates mistakenly tune cluster size or partitioning instead of file coalescing. A useful memory tip: think "small files, big overhead" — always aim for files around 256 MB to minimize metadata calls and maximize Spark throughput.
⚠ Common exam trap
Watch out — candidates often assume scaling the cluster (Option A) will solve any performance issue, but they fail to recognize that metadata operations like file listing are not parallelized across nodes and are limited by the storage account's API limits, not compute resources.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Pre-process the raw data to coalesce small JSON files into larger parquet files (e.g., 256 MB each).
The job spends most of its time in the 'listing files' stage because reading thousands of small JSON files (each ~10 KB) from Azure Data Lake Storage Gen2 incurs high metadata operation overhead. Coalescing these small files into larger Parquet files (e.g., 256 MB each) reduces the number of files that Spark must list and process, dramatically cutting down the listing stage time and improving overall throughput.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Increase the number of nodes in the cluster to 16.
Why it's wrong here
More nodes increase parallelism but the bottleneck is file listing, which is not fully parallelized.
- ✗
Change the output format from JSON to Delta and enable Delta caching.
Why it's wrong here
Delta caching helps reads but does not solve the file listing bottleneck.
- ✓
Pre-process the raw data to coalesce small JSON files into larger parquet files (e.g., 256 MB each).
Why this is correct
Reduces the number of files, drastically cutting listing time.
- ✗
Use Azure Data Factory instead of Databricks to copy the raw data.
Why it's wrong here
ADF also lists files; the bottleneck remains.
Go deeper
Related to this question
About these practice questions
One of 760 original DP-203 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
2 more ways this is tested on DP-203
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. You are a data engineer for a financial services company. You manage an Azure Data Lake Storage Gen2 account that stores real-time stock trade data ingested from Azure Event Hubs via Azure Stream Analytics. The data is partitioned by date and symbol. Each day, a downstream Azure Databricks job runs an ETL process to aggregate trades into 5-minute bars and writes the results to a separate container. The Databricks job runs on a cluster with 10 worker nodes (Standard_DS3_v2) using Auto-Scaling enabled (2-10 workers). Recently, the job has been taking longer than expected, and you observe that the cluster is often at 10 workers but still the job duration increased by 30%. The storage account shows high transaction costs. You suspect the issue is related to how data is read. What should you do to optimize the job's performance and reduce costs?
medium- A.Convert the data to Avro format to reduce file size.
- B.Increase the maximum number of workers to 20 and use a larger instance type.
- ✓ C.Modify the Stream Analytics job to output larger files (e.g., set the minimum file size to 100 MB) and use coalesce in Databricks to reduce the number of output partitions.
- D.Move the data to Azure Blob Storage Premium tier to reduce latency.
Why C: The performance issue stems from reading many small files (small file problem) in Azure Data Lake Storage Gen2, which increases transaction costs and slows down Spark jobs. By configuring Stream Analytics to output larger files (e.g., minimum 100 MB) and using coalesce in Databricks to reduce output partitions, you minimize the number of files read/written, reducing overhead and transaction costs. This directly addresses the root cause—high transaction costs and cluster saturation at 10 workers—without unnecessary scaling or tier changes.
Variation 2. A data engineer is optimizing an Azure Data Lake Storage Gen2 account used for big data analytics. The account contains billions of small files (under 1 MB). The analytics jobs are slow and cost more than expected. Which THREE actions should the engineer take to improve performance and reduce costs?
hard- ✓ A.Convert data to columnar file formats such as Parquet.
- B.Move data to the cool tier to reduce storage costs.
- C.Enable soft delete to protect against accidental deletion.
- ✓ D.Use blob index tags to partition data logically.
- ✓ E.Consolidate small files into larger files (e.g., 100 MB or more).
Why A: Converting data to columnar formats like Parquet (A) reduces the amount of data read during analytics, improving performance and reducing I/O costs. Using blob index tags (D) enables logical partitioning for faster query pruning. Consolidating small files into larger files (E) reduces metadata overhead and improves throughput. Moving data to cool tier (B) does not improve performance and may add retrieval costs. Enabling soft delete (C) increases data protection but does not address performance or cost issues.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DP-203 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DP-203 exam.