Prepare and test your skills

Prepare and test your skills

Selecting a core batch and stream processing service means matching the execution engine to the shape of the work. Cloud Dataflow (opens in a new tab) is the serverless engine for unified batch and stream pipelines written with Apache Beam (Beam). Cloud Dataproc and Cloud Data Fusion cover the other shapes: Dataproc-related Spark services run legacy cluster and Hadoop-ecosystem workloads, while Data Fusion provides visual data integration. Dataflow handles provisioning, scaling, and fault tolerance so developers focus on pipeline logic.
Cloud Dataflow (opens in a new tab) pipelines use a staged model where data flows from a source through transforms to a destination. A pipeline reads data from a source, applies transforms and aggregations, and writes results to a destination such as BigQuery. The same Beam model handles both bounded batch data and unbounded streaming data with windowing, grouping, and joining for streaming state.
Pipelines cover four common shapes:
Runner-based execution in Beam separates what to compute from how and where it runs. Apache Beam supports multiple runners, and the Dataflow runner runs a Beam pipeline on the Dataflow service. When the Dataflow runner is selected, the runner uploads executable code and dependencies to a Cloud Storage bucket and creates a Dataflow job, then Dataflow allocates a pool of virtual machines (VMs) to execute the pipeline stages.
A typical extract, transform, load (ETL) and business intelligence (BI) solution shows the flow across services:
For basic movement, a Google-provided template can run the pipeline without custom Beam code, and some templates support JavaScript user-defined functions (UDFs) for light custom logic. For complex logic, the pipeline is built with the Beam software development kits (SDKs) for Java, Python, or Go.
Exam tip: Use a Google-provided Dataflow template with a JavaScript UDF for basic movement plus light customization; build with the Apache Beam SDK when the pipeline needs complex transforms, joins, or ML logic.
Dataflow templates make pipelines reusable and separable from the people who run them. A template lets each job change specific pipeline parameters, lets anyone with permissions deploy the pipeline later, and provides open-source Apache License 2.0 code that can seed new pipelines. Dataflow (opens in a new tab) has no built-in cross-pipeline communication mechanism, so data flows from one pipeline instance to durable storage or a cache and the next pipeline reads it back, using Cloud Storage for durable sharing or App Engine for in-memory caching.
Recurrent execution is handled outside the single job definition:
Choose Dataflow data pipelines when the need is repeated Dataflow schedules with multi-run cost visibility, and choose Airflow when Dataflow is one step in a larger directed acyclic graph (DAG) workflow.
The Dataflow monitoring interface in the Google Cloud console makes pipeline jobs observable during execution. The interface shows a graphical representation of the pipeline with progress and execution details for each stage, which helps spot bottlenecks and high latency, and job profiling exposes central processing unit (CPU) usage and memory allocation. Beam metrics (opens in a new tab) can be exported as Cloud Monitoring custom metrics, such as counters for malformed records versus empty payloads, to drive dashboards and alerting policies.
Performance and scale depend on matching resources to pipeline steps and destinations. Right fitting lets different pipeline steps mix CPUs and graphics processing units (GPUs) to target costly steps without overprovisioning the whole job, while accelerators including GPUs and tensor processing units (TPUs) speed machine learning and image-processing tasks. After processing, results flow from Dataflow workers to high-capacity sinks that absorb large streams, including Bigtable, BigQuery, and Pub/Sub, where a large Bigtable cluster can scale horizontally to about one million messages per second.
Robust Beam code is built around ParDo and DoFn, where ParDo applies parallel processing and DoFn defines the distributed per-element function. A DoFn should behave as a pure function that does not depend on hidden or external state, has no observable side effects, and is deterministic, because many instances run on different machines with no knowledge of each other. Dataflow (opens in a new tab) provides exactly-once processing so each element in an input PCollection is processed exactly once from the user's view, but the service does not guarantee how many times a DoFn is invoked, how elements are grouped, how many DoFn instances are created, or whether retries and backup copies occur.
That fault-tolerant behavior sets strict coding rules. The service serializes element processing per DoFn instance and may retry code after worker issues, so manual side effects such as temporary files with non-unique names can break. Dead-letter queues isolate bad records by routing parse failures to a separate output while valid records continue, and batching with GroupByKey, concurrency limits on external calls, and controlled parallelism for slow or external operations prevent overload and fused-step slowdowns.
BigQuery (opens in a new tab) is the analytical warehouse that stores historic, large-scale data for analytics and decision-making. Processing engines such as Dataflow, Cloud Data Fusion, and Datastream move and transform data into BigQuery tables. Data flows from sources such as Pub/Sub topics, Cloud Storage buckets, or operational databases through batch or streaming pipelines into BigQuery, where SQL-based transformation and query serving deliver data to dashboards, machine learning, and downstream applications.
BigQuery (opens in a new tab) datasets anchor the warehouse design because they combine an analytical database with analytical components and procedures for serving insights. Warehouses commonly grow to terabytes to petabytes, so recovery time and cost depend on how much data must be restored to meet recovery point and recovery time objectives. Many warehouses are append-only with mostly static historic data, which allows a strategy that backs up and restores only the newly appended data instead of the full warehouse.
Location choice defines the failure domain for a BigQuery dataset. A dataset stores data in either a regional location such as Iowa (us-central1) or a multi-region location such as US or EU that spans a large geographic area. A multi-region location does not provide cross-region replication nor regional redundancy because data is still stored in a single region within that geography, so machine, zonal, or regional failures affect availability differently and must be matched to locality rules.
Exam tip: A BigQuery multi-region location does not replicate data across regions; data rests in a single region inside the multi-region geography.
Ingestion pathways connect processing engines to BigQuery for both batch history and continuous streams. Dataflow (opens in a new tab) is a fully managed service for running Beam pipelines that transform and enrich data in both stream and batch modes with windowing and session-analysis primitives and a connector for BigQuery. Cloud Data Fusion, built on the open source CDAP project, is a fully managed data integration service where pipelines are built graphically as a DAG of sources, transformations, aggregates, sinks, and other nodes, and the planner converts that DAG into parallel computations executed as an Apache Spark job on Managed Service for Apache Spark.
Datastream provides change data capture (CDC) replication from operational sources into Google Cloud destinations. Datastream writes change events directly to a BigQuery dataset through the BigQuery Write API, where changes are merged continuously with existing data as UPSERTs. Alternatively, Datastream writes change files to Cloud Storage as a staging destination, and then Dataflow templates built for Datastream-generated files read data from Cloud Storage and load it into BigQuery, Cloud SQL for PostgreSQL, or Spanner to maintain up-to-date replicated tables.
Batch orchestration often depends on Managed Airflow and ephemeral compute. In a typical batch pattern, Managed Airflow validates that new files arrived in the Cloud Storage ingestion bucket, then manages an ephemeral Managed Service for Apache Spark cluster that runs an ETL job and is deleted when processing ends. The ordered workflow is:
Because batch pipelines can be recreated and restarted, disaster recovery focuses on recovering the ingested data in Cloud Storage, the processed data in the lake, and metadata such as databases, tables, columns, and partitions stored in Dataproc Metastore. For streaming, Pub/Sub subscriptions buffer delayed data when pipelines stop, and processing resumes from the backlog when pipelines run again, which lowers recovery point objective.
Dataflow pipelines both read from and write to BigQuery, and the chosen method determines quota use and latency. Beam supports BigQuery I/O in Java, Python, and Go, with BigQueryIO in Java exposing two read methods that consume different quotas. Table export is the default read method, where BigQueryIO invokes a BigQuery export request that writes table data to a temporary Cloud Storage location and then BigQueryIO reads data from that temporary location. Direct read instead uses the BigQuery Storage API to read table rows directly from BigQuery over gRPC with high throughput, which removes the export step.
| Read method | Data flow | Quota and performance tradeoff |
|---|---|---|
| EXPORT | Pipeline sends export request to BigQuery, BigQuery writes data to temporary Cloud Storage, then pipeline reads from Cloud Storage | Consumes BigQuery export quotas and adds wait time because the export must complete before processing starts |
| DIRECT_READ | Pipeline reads table rows directly from BigQuery through the BigQuery Storage API | Avoids export quotas and can decrease job run time through high-throughput direct reads |
Writing to BigQuery also splits by pipeline type. Batch pipelines that use BigQuery load jobs consume load-job quotas at the table and project level, while streaming pipelines that use streaming inserts consume streaming-insert quotas. Avoid using load jobs to append data thousands of times per day into one table; use a streaming pipeline with streaming inserts or the Storage Write API for near real-time appends. Dataflow (opens in a new tab) parallelizes work across worker VMs and can autoscale and dynamically rebalance work, but excessive calls to external services such as BigQuery or Pub/Sub can overwhelm quotas, so batching requests and limiting concurrent calls protects downstream systems.
SQL-based transformation in BigQuery turns stored tables into curated results through query jobs submitted from the console, the bq query command, the REST API, or client libraries. Multi-statement queries run multiple statements in sequence with shared state and support procedural language statements for variables and control flow, which are often used in stored procedures. Saved queries can be private to one user, shared at the project level with specific principals, or public, which supports reuse without copying data.
When BigQuery runs a query, the query is broken into an execution tree of stages that contain steps able to run in parallel. Stages communicate through a fast distributed shuffle tier that stores intermediate data from stage workers and uses high-bandwidth networking and memory to move data quickly to worker nodes. When all planning information is ready, BigQuery generates a query plan that can be viewed graphically with performance insights, and additional workers monitor progress and dynamically adjust the plan as stage results arrive. When the query completes, BigQuery writes results to persistent storage and returns them, which lets the next identical query be served from cached results.
Concurrency and cost controls shape how queries share the warehouse. BigQuery runs many queries in parallel and can queue queries to run when resources are available, then redistributes resources fairly between new and running queries so performance depends on concurrent load rather than submission order. The query plan, INFORMATION_SCHEMA.JOBS views, and the jobs.get method expose stage output sizes that reveal optimization chances, such as filtering earlier when one stage writes far more output than others. BigQuery (opens in a new tab) offers on-demand pricing based on bytes scanned with fixed per-project processing capacity and capacity-based pricing based on purchased dedicated capacity with reservations, plus project-level quotas and custom cost controls.
Storage strategy decides whether data lives in BigQuery storage or in external Cloud Storage accessed as BigLake tables. Processed lake data is commonly stored in Cloud Storage in columnar formats such as Parquet and ORC because those formats store efficiently and serve analytical workloads faster than JSON or CSV, and formats that support parallelizable reads such as Avro outperform CSV files with embedded newlines or compressed files. A Hive-partitioned layout lets queries prune partitions with partitioning columns, while file count and file size must be designed for preferred query performance.
If BigLake queries cannot meet service-level agreement requirements and cannot be tuned, convert the exposed data to BigQuery storage and redefine authorized views to use the BigQuery tables. This change generally does not disrupt consumers or require query rewrites, while enabling optimizations unavailable to BigLake tables such as materialized views with different partitioning and clustering than base tables and use of BigQuery BI Engine. For direct programmatic access, the BigQuery Storage Read API can read BigQuery tables and BigLake tables with filtering and fine-grained access control for stable analytics or machine learning consumers, while the Cloud Storage JSON or XML APIs expose buckets directly when consumers cannot use SQL or need formats unsupported by the Storage Read API. Direct bucket access lacks filtering and fine-grained control and creates copies that increase storage cost and lineage overhead, so the BigQuery API is preferred for analytical applications whenever possible.
Streaming delivery extends the same storage with live topics. An ingest pipeline reads raw events, enriches them, saves curated data to the BigQuery base table, and at the same time publishes enriched events to a dedicated Pub/Sub topic where each subscriber consumes independently and can filter for relevant events. The pipeline can also aggregate event statistics and publish them to a separate topic for another consumer, which supports continuously updated dashboards, database replication for low-downtime migration and hybrid-cloud configurations, and event-driven architectures that consume event data from BigQuery and Cloud Storage.
Messaging and ingestion frameworks decouple data producers from data consumers so streaming events can be ingested, enriched, and fanned out without direct connections. Google Cloud Pub/Sub (Pub/Sub) (opens in a new tab) provides serverless asynchronous messaging for server events, user interactions, parallel processing, and IoT streaming, while Apache Kafka (Kafka) provides a broker-based log that Cloud Dataflow (Dataflow) reads through the Beam KafkaIO connector. Eventarc is distinct from both because it manages the flow of state changes for event-driven actions such as error remediation and resource labeling rather than high-volume data ingestion.
Pub/Sub ingestion commonly follows an enrich-and-fan-out pattern where a streaming pipeline reads raw events, enriches them, and saves curated rows to a BigQuery base table. The same pipeline publishes the enriched events to a dedicated topic consumed by multiple subscribers that filter for only relevant events, and it publishes aggregate statistics to its own topic for another consumer. Data flows from producers to topics to subscriptions to consumers, so one publish can serve many independent subscribers without the producer knowing each consumer.
Enriched Pub/Sub subscriptions support several streaming consumer patterns:
Message format in Pub/Sub affects cost and processing, and high-volume streams in a data mesh architecture work well with Avro or Protobuf. Producers using those formats can assign schemas to Pub/Sub topics, and the schema helps ensure that consumers receive well-formed messages. Because streaming structures change constantly, producers and consumers must coordinate versioning of the message interface.
| Versioning approach | How version is tracked | Tradeoff supported by the design |
|---|---|---|
| New topic per change | Message version is implied by the topic name, for example click_events_v1, often with an explicit Pub/Sub schema | Messages stay strongly typed with no variation within a topic, but producers may have to publish to multiple active topics while consumers migrate, creating gaps or duplicates |
| Same topic with attribute | Structure can change in the same topic and a message attribute separate from the payload defines the version, for example v=1.0 | Gaps and duplicates are avoided, but all consumers must be ready for the new type and producers cannot use Pub/Sub topic schemas |
| Hybrid with flexible section | Schema keeps an arbitrary data section for new fields | Balance between strongly typed data and frequent, complex version changes |
Message ordering in Pub/Sub (opens in a new tab) is a feature that lets a subscriber receive messages in the order they were published. Ordering is not recommended with Dataflow because the distributed processing model breaks the end-to-end guarantee while adding latency and reducing parallelism.
The limitations of ordering with Dataflow are specific:
Pub/Sub single message transforms (SMTs) manipulate, validate, and filter messages by attributes or data as they stream. Subscriptions that feed Dataflow should not use SMTs that filter out messages because filtered messages make the subscription backlog appear larger than what reaches Dataflow until the SMT processes them, which interferes with autoscaling. Topic SMTs that filter messages do not cause the same autoscaling problem because filtering happens before the subscription backlog is measured.
Exam tip: Subscription SMT filtering interferes with Dataflow autoscaling, while topic SMT filtering does not.
Scale and reliability for Pub/Sub to BigQuery pipelines depend on acknowledgment, worker capacity, and write-path efficiency. When backlog grows, increase the Pub/Sub acknowledgment deadline to slightly longer than the maximum expected processing time to prevent premature redelivery, increase the number of Dataflow workers to add processing capacity, and enable exponential backoff for transient failures. For sustained performance, migrate streaming writes from standard inserts to the BigQuery Storage Write API over gRPC for better performance and higher quotas, reduce getTable calls by caching table existence in worker memory or batching checks per bundle, optimize work away from millions of active high-cardinality keys, and proactively manage BigQuery and Compute Engine quotas for queries per second, IP addresses, and CPUs.
Apache Kafka ingestion with Dataflow (opens in a new tab) centers on the Beam KafkaIO connector, which controls how event time and watermarks advance through the streaming pipeline. By default the watermark behavior is tied to processing and event time, and pipelines can call withTimestampPolicyFactory to assign a TimestampPolicy that calculates the watermark from Kafka log append time or message creation time. Correct timestamp policy selection matters because the watermark determines when windowed aggregations consider data complete.
The KafkaIO connector has two read implementations, the older ReadFromKafkaViaUnbounded and the newer ReadFromKafkaViaSDF, and Dataflow automatically chooses the best implementation based on SDK language and job requirements. Pipelines that use withTopic or withTopics query Kafka for available partitions at pipeline construction time, so the machine that constructs the pipeline must have permission to connect to Kafka. Using withTopicPartitions avoids that construction-time connection because partition assignments are supplied explicitly. For production, launch from a consistent environment with Flex templates and reduce verbose KafkaIO logging, for example by overriding SubscriptionState to WARN.
Kafka operations add explicit networking ownership that Pub/Sub does not require. Dataflow launches workers in a Virtual Private Cloud (VPC) network by default, so teams may need to select a different network and subnet and create firewall rules that allow Dataflow worker machines to reach the Kafka brokers. If VPC Service Controls are used, place the Kafka cluster inside the perimeter or extend the perimeter to the authorized VPN or Cloud Interconnect path. When Kafka runs outside Google Cloud, connect Dataflow to the cluster through shared private address space using Dedicated Interconnect or IPsec VPN, or through public addresses using public internet, Direct Peering, or Carrier Peering, with Dedicated Interconnect offering the most predictable performance and reliability at the cost of longer provisioning by third parties.
The operational difference is that Pub/Sub (opens in a new tab) removes broker, partition, and cluster management while Kafka keeps control of brokers, partitions, and network paths at the cost of configuration. Pub/Sub pipelines scale by adjusting Dataflow workers, acknowledgment deadlines, retry behavior, quotas, and the BigQuery write path, without provisioning brokers or broker connectivity. Kafka pipelines also use Dataflow workers and Flex templates, but they additionally depend on VPC design, firewall rules, construction-time Kafka permissions, watermark timestamp policy, and, for external clusters, Interconnect, VPN, or peering. Choose Pub/Sub when the goal is serverless fan-out to many filtering subscribers with schema enforcement and minimal infrastructure, and retain Kafka when existing Kafka topics, partitions, log times, or ecosystem dependencies must be preserved despite the added networking and lifecycle management.
Use a Google-provided Cloud Dataflow template with a JavaScript user-defined functions (UDFs) for basic movement plus light customization. Build with the Apache Beam (Beam) software development kits (SDKs) for Java, Python, or Go when the pipeline needs complex transforms, joins, or machine learning logic.
A BigQuery multi-region location does not replicate data across regions or provide regional redundancy. Data is still stored in a single region within the geography such as US or EU, so machine, zonal, or regional failures affect availability differently and must be matched to locality rules.
Subscription single message transforms (SMTs) that filter messages interfere with Cloud Dataflow (Dataflow) autoscaling, while topic SMT filtering does not. Filtered messages make the Google Cloud Pub/Sub (Pub/Sub) subscription backlog appear larger than what reaches Dataflow until the SMT processes them, while topic filtering happens before the subscription backlog is measured.
An enterprise e-commerce platform is designing a real-time event ingestion architecture on Google Cloud for order processing and inventory updates. The system must satisfy the following architectural and operational requirements:
merchant_id).Which messaging framework should the enterprise implement?
A Confluent Cloud managed Kafka cluster with topic replication linked directly to Pub/Sub via Cloud Storage Ingestion
Google Cloud Pub/Sub with ordering keys configured using the merchant_id
Google Cloud Pub/Sub standard topics without ordering keys, handling event ordering using downstream Dataflow session windows
A self-managed Apache Kafka cluster deployed on Google Kubernetes Engine (GKE) with topics partitioned by merchant_id
Last updated