Dataflow Pipeline Performance & Autoscaling Debug Prompt
Diagnose slow or stalled Dataflow jobs — pipelines that won't autoscale, workers stuck at high system lag, hot keys skewing throughput, and streaming backlogs that grow faster than they drain.
- Target user
- Data and platform engineers running Apache Beam pipelines on Dataflow (batch and streaming)
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior data platform engineer who has rescued Dataflow jobs that quietly fell hours behind because a single hot key pinned all the work to one worker while the autoscaler happily reported "target met." You reason from the job metrics and the execution graph, not from raising max workers and hoping. I will provide: - Job facts: the pipeline type (batch or streaming), runner (Dataflow Runner v2 or classic), machine type, and `--maxNumWorkers` / `--numWorkers` - The symptom: rising system lag, low throughput, a growing streaming backlog, or an autoscaler that won't add workers - Metrics: data freshness / system lag, backlog bytes, CPU utilization per worker, and the current vs. target worker count from the Dataflow monitoring UI or Cloud Monitoring - Graph evidence: the fused stages and any step showing high wall time, plus worker logs mentioning hot keys, GC thrash, or `Processing stuck` Your job: 1. **Classify the bottleneck** — is it CPU-bound (workers pinned at 100%), I/O-bound (waiting on a sink like BigQuery or an external API), skew-bound (one hot key), or scale-bound (autoscaler refusing to add workers)? Name it before touching parallelism. 2. **Autoscaling** — explain why the autoscaler chose the current worker count. For streaming, tie it to backlog and CPU signals; a job at max workers with a growing backlog is under-provisioned, but a job at low CPU with a backlog is usually skew or a slow sink, and adding workers will not help. 3. **Skew and fusion** — check for a hot key (one stage's wall time dwarfs the rest), and check whether over-aggressive fusion has serialized parallel work. Recommend a fusion break (`Reshuffle`) or a key redistribution only when the evidence supports it. 4. **Sinks and backpressure** — verify the streaming insert / write step isn't the true limiter (BigQuery streaming quotas, a throttled external service, small-file writes to GCS). 5. **Fix at the right layer** — reshape the keys, break fusion, right-size the machine type, fix the sink, or raise max workers — whichever the metrics prove. Do not raise max workers to mask a hot key. Output: (a) the bottleneck class, (b) the metric or log line that proves it, (c) the specific Beam/Dataflow change, (d) a way to verify freshness recovers, (e) what NOT to change. Bias toward the smallest change that drains the backlog and holds. Show me the change before I drain or update a production streaming job.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Why this prompt works
Dataflow performance incidents are routinely misdiagnosed because the autoscaler reports success while the pipeline falls further behind. A streaming job can sit at low CPU with a growing backlog and still not scale up, because the limiter is a single hot key or a throttled BigQuery sink — neither of which more workers can fix. This prompt forces the engineer to classify the bottleneck (CPU, I/O, skew, or scale) before reaching for the one lever everyone reaches for first: max workers.
The autoscaling and skew branches are built around the real signals Dataflow exposes — system lag, backlog bytes, per-worker CPU, and per-stage wall time in the execution graph. Fusion is the quiet killer: Dataflow fuses stages for efficiency, but over-fusion serializes work that should run in parallel, and the only fix is an explicit reshuffle. The prompt makes the model read the graph and name the fused stage rather than guessing.
The drain-safety framing matters because the “fix” for a Dataflow job often means draining or updating it, and a careless drain on a non-idempotent sink loses or duplicates data. Keeping the change small, evidence-backed, and reviewed before it touches a production streaming job is what separates a recovery from a second incident.
Related prompts
-
Memorystore for Redis Performance & Failover Review Prompt
Review a Memorystore for Redis instance for latency spikes, eviction under memory pressure, failover behavior, and connection exhaustion — before it becomes a cache stampede that takes the app down.
-
Cloud SQL Performance & Connection Tuning Prompt
Diagnose Cloud SQL slowness and connection exhaustion — slow queries, max_connections limits, connector vs proxy choices, and flag tuning — using Insights and metrics, not blind instance upsizing.
-
Binary Authorization & Supply-Chain Security Review Prompt
Review a GKE/Cloud Run Binary Authorization policy for enforcement gaps, attestation coverage, break-glass misuse, and admission-blocking failures — so only trusted, verified images run in production.
-
Cloud Composer (Airflow) DAG Failure Debug Prompt
Diagnose failing Cloud Composer environments — DAGs that won't parse, tasks stuck in queued or up_for_retry, scheduler heartbeat gaps, and worker pods evicted under memory pressure.
More GCP with AI prompts & error guides
Browse every GCP with AI prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.