Dataflow is Google Cloud's serverless data-processing service that runs pipelines written with the Apache Beam SDK as a managed workload. Its signature feature is the Unified model: the same code handles streaming and batch. It's the de facto standard for Pub/Sub to BigQuery ETL.
| Window Type | Use Case |
|---|---|
| Fixed (Tumbling) | Fixed intervals (e.g., aggregate every 1 minute) |
| Sliding | Overlapping (5-minute windows every 1 minute) |
| Session | Closed on inactivity (e.g., user behavior) |
| Global | No window (batch-oriented) |
# Python Apache Beam
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions, StandardOptions
options = PipelineOptions(streaming=True)
with beam.Pipeline(options=options) as p:
(p
| "Read from Pub/Sub" >> beam.io.ReadFromPubSub(topic='projects/PROJECT/topics/events')
| "Parse JSON" >> beam.Map(lambda msg: json.loads(msg))
| "Window" >> beam.WindowInto(beam.window.FixedWindows(60))
| "Group by user" >> beam.GroupByKey()
| "Write to BQ" >> beam.io.WriteToBigQuery(
'PROJECT:dataset.events',
schema='user_id:STRING,count:INTEGER,window_start:TIMESTAMP',
write_disposition=beam.io.BigQueryDisposition.WRITE_APPEND)
)| Item | Price (us-central1) |
|---|---|
| vCPU | $0.069/h (Batch) / $0.075/h (Streaming) |
| Memory | $0.0046/GB/h |
| Shuffle | $0.011/GB (Batch) / $0.018/GB (Streaming Engine) |
| FlexRS (Spot) | 40% discount |
| Item | Dataflow | Dataproc (Spark) | AWS Kinesis Data Analytics |
|---|---|---|---|
| Model | Beam (Unified) | Spark / Hadoop | Flink |
| Serverless | ◎ | Has Serverless mode | ○ |
| OSS compatibility | ○ (Beam OSS) | ◎ (Spark/Hadoop) | ○ (Flink) |
| Pricing | Worker time | Cluster time | KPU time |
How are Dataflow and Apache Beam related?
Apache Beam is an open-source unified programming model, and Dataflow is Google's managed version of its Runner (execution engine). The same Beam code can also run on Spark or Flink.
What is the difference between Streaming and Batch?
Streaming pulls data continuously from Pub/Sub, while Batch reads once from GCS or BigQuery. The same Beam pipeline handles both (the Unified model).
What are Window, Trigger, and Watermark?
Window groups data over a time range, Trigger decides when to emit results, and Watermark defines the boundary for late data. These are the three core concepts of streaming processing.
What is Dataflow Prime?
An enhanced version of Dataflow with Vertical Autoscaling (automatic resource tuning), Right-fitting, and improved shuffle. Especially effective for complex pipelines.
How is Dataflow priced?
You pay for Worker time (vCPU + memory + storage) plus Shuffle data and Streaming Engine data. Streaming runs around the clock and gets expensive, so the Autoscaler is essential for keeping costs down.
How does it compare to Apache Spark?
Spark is a processing engine, while Beam is a programming model plus a Runner abstraction. Dataflow's strength is serverless management; Spark on Dataproc's strength is OSS compatibility.
What are Dataflow Templates?
Pre-built templates from Google (Pub/Sub to BQ, GCS to BQ, and more). You can run them from the UI without writing code, and Flex Templates let you customize them.
How do I debug and monitor Dataflow jobs?
Use the Dataflow UI graph view, Worker Metrics, Cloud Profiler integration, and Dataflow Insights for automatic diagnostics.
Related Articles: Data Processing
Pub/Sub 完全ガイド|料金・Push vs Pull・Ordering Key・Kafka 比較 (GCP)
Google Cloud Pub/Sub の全機能解説。Push vs Pull、Ordering Key、Exactly-once、Dead Letter、Schema Registry、Pub/Sub Lite、AWS SNS/SQS / Kafka 比較、料金体系を網羅。
GCP Professional Cloud Developer (PCD) 完全ガイド|Cloud Run・GKE・CI/CD・APM
Google Cloud Professional Cloud Developer の試験範囲、Cloud Run / GKE / Cloud Build / Cloud Trace、AWS DVA / Azure AZ-204 比較、学習ロードマップを徹底解説。
App Engine 完全ガイド|Standard vs Flexible・料金・Cloud Run 比較 (GCP)
Google App Engine の Standard と Flexible の違い、料金、Traffic Splitting、Cron、Cloud Run / Cloud Functions との使い分け、AWS Elastic Beanstalk / Azure App Service 比較を徹底解説。
BigQuery 入門|サーバレス DWH の全機能・料金・他クラウド比較
Google Cloud BigQuery の基礎から実装まで。サーバレスアーキテクチャ、料金モデル (オンデマンド / Editions)、BigQuery ML、Pub/Sub 連携、Snowflake / Redshift / Synapse との比較を解説。
Google Cloud and Apache Beam are trademarks of their respective owners. For the latest information, see the official Dataflow docs.
Practice with certification-focused question sets
Visit the GCP exam prep pageNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
Google Cloud Certification Roadmap (2026)
Choose your GCP certification path — Foundational, Associate...
CDL Cloud Digital Leader: Complete Exam Guide (2026)
Pass the Cloud Digital Leader exam — cloud business value, G...
GAIL Generative AI Leader: Complete Exam Guide (2026)
Pass the Generative AI Leader exam — Gemini, Vertex AI, Work...
Vertex AI Fundamentals for GCP Certs (2026)
Vertex AI basics every cert candidate needs — Workbench, Pip...
Associate Cloud Engineer (ACE): Complete Guide (2026)
Pass the Associate Cloud Engineer exam — Console, gcloud, pr...