hardMultiple ChoiceObjective-mapped
PDE Practice Question: A company runs a Dataproc cluster with 10 worker…
A company runs a Dataproc cluster with 10 worker nodes for a Spark streaming job that processes data from Pub/Sub (via Pub/Sub Lite) and writes to Cloud Storage. They observe that the job is producing many small files in Cloud Storage, leading to high costs and performance issues in downstream batch pipelines. The team wants to consolidate output files while maintaining low latency. What is the best solution?
⚠ Common exam trap
A common mix-up: candidates choose a separate compaction job (Option A) because it seems like a straightforward fix, but they overlook the latency penalty and the fact that Spark's native streaming configurations can achieve the same goal without extra overhead.
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
✓
Use windowed streaming with a longer window duration and Spark's file size configuration
Using a longer window duration in Spark Streaming allows more data to accumulate before writing, and combining this with Spark's file size configuration (e.g., `spark.sql.files.maxRecordsPerFile` or `spark.hadoop.mapreduce.fileoutputcommitter.algorithm.version=2`) ensures that output files are consolidated into larger sizes. This reduces the number of small files in Cloud Storage while maintaining low latency by avoiding an extra compaction job or reducing parallelism.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Run a separate compaction job that periodically merges small files into larger ones
Why it's wrong here
Adds complexity and delay; not a real-time solution.
- ✓
Use windowed streaming with a longer window duration and Spark's file size configuration
Why this is correct
Allows batching data to create larger files with acceptable latency.
- ✗
Reduce the number of workers to force more data per task
Why it's wrong here
Reducing workers may increase latency and does not guarantee larger files.
- ✗
Switch from Dataproc to Dataflow, which has built-in file sharding optimization
Why it's wrong here
Significant architectural change; not the simplest immediate fix.
Go deeper
Related to this question
About these practice questions
This PDE question is part of Courseiva's 890-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This PDE practice question is part of Courseiva's free Google Cloud 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 PDE exam.