Prepare and test your skills

Prepare and test your skills

Complex pipeline orchestration on Google Cloud splits by workload shape. Cloud Composer is the fully managed service for Apache Airflow for authoring, scheduling, and monitoring long-running data pipelines, while Workflows (opens in a new tab) is the serverless service for orchestrating loosely coupled, HTTP-based services in a defined order. Composer controls data jobs that span cloud environments and on-premises data centers, and Workflows sequences service calls with less code and explicit, observable dependencies.
Cloud Composer is Google Cloud's fully managed workflow orchestration service built on Apache Airflow. An author defines pipelines as directed acyclic graphs (DAGs), and the service schedules, runs, and monitors those DAGs across cloud and on-premises systems. Because orchestration lives in the DAG rather than in each processing engine, one control plane can coordinate extracts, loads, transformations, and API calls end to end.
Composer DAGs execute work through operators that abstract multi-cloud technologies. The three representative uses are:
A task in the DAG calls its operator, the operator invokes the target system, and downstream tasks run only after their dependencies complete. For example, the same extract, transform, load (ETL) pattern that used a Hive operator can use the BigQuery (opens in a new tab) operator to run transformations directly in BigQuery. Composer also provides Google Cloud operators such as the Dataflow (opens in a new tab) operator, so an Airflow workflow can launch and manage a Dataflow job as one step in a larger pipeline.
Composer also supports migration and recurring execution of existing batch estates. Composer provides a tool for converting Oozie workflows to Airflow workflows, and Dataproc Workflow Templates can be managed alongside Composer for Spark-based ETL. For recurring Dataflow execution, the supported scheduling paths include Dataflow data pipelines, Cloud Scheduler, the Airflow Dataflow operator inside a Composer DAG, or a custom cron process on Compute Engine.
Workflows is a serverless orchestration service for running loosely coupled services in an order you define. A workflow separates the logic that sequences and links services from core business logic, so a single definition can call any HTTP-based API, wait for all operations to complete, and expose the service dependencies end to end. Choose Workflows when the problem is coordinating microservices and Google Cloud APIs with minimal infrastructure code rather than scheduling heavy data processing.
A workflow consists of a series of steps written in YAML or JSON using the Workflows syntax. The Workflows standard library functions and built-in environment variables help construct arguments and process responses as data flows from one step to the next. Workflows can be event-driven, performing a sequence of operations across multiple systems in response to an event such as a file arrival or an app request.
A representative event-driven flow moves data from storage through AI services to a database in this order:
In this flow, Workflows sits between the event source and the AI services, and Firestore sits downstream as the system of record for the derived tags.
Connectors are lightweight, serverless integrations that let a workflow call other Google Cloud APIs without hand-building request formats. The workflow calls the connector method with arguments, the connector formats the request for the target API, and the response flows back into the workflow for the next step. This reduces code because the author does not need to know the low-level details of each Google Cloud API.
Documented connector patterns include translating files with the Cloud Translation API connector in asynchronous batch mode and saving results in a Cloud Storage bucket, and running multiple BigQuery query jobs serially one after the other. Workflows also publishes a connector to Application Integration (opens in a new tab), so the two products can be used together to reach business systems and human processes. For example, a workflow can trigger and wait for an integration, or perform an update to a Salesforce instance through Application Integration.
A combined refund flow shows how control passes between the two services. When a mobile app requests a refund for digital content, Workflows first removes the content and then initiates the refund process in Application Integration, which applies heuristic checks and potentially human approval. Data then flows back from Application Integration to Workflows, and Workflows either grants the refund or restores the content based on that result.
The choice of orchestration service depends on the type and weight of the work. Composer depends on its operators to reach processing engines, while Workflows depends on connectors and direct HTTP calls to reach services. Use Composer when resilience comes from scheduled DAGs, retries, and cross-system operators such as BigQuery and Dataflow operators, and use Workflows when resilience comes from an explicit, observable sequence of service calls that waits for completion.
| Service | Primary unit | Choose when |
|---|---|---|
| Cloud Composer | Apache Airflow DAG with operators | The work is scheduled, multi-step data orchestration spanning cloud and on-premises systems |
| Workflows | YAML or JSON workflow of service steps | The work is lightweight, event-driven coordination of HTTP-based APIs and microservices |
| Cloud Data Fusion | Visual pipeline with plugins | The work is ETL or ELT data pipeline development with drag-and-drop sources and sinks |
Exam tip: Use Cloud Data Fusion for ETL/ELT data pipelines, use Cloud Composer for scheduled Airflow DAGs across clouds and on-premises, and use Workflows for lightweight orchestration of API-based services.
Designing stream and batch data transformations using Apache Beam is the practice of writing unified processing logic that Cloud Dataflow can execute for both bounded batch data and unbounded streaming data. The same programming model of pipelines, PCollections, transforms, and runners applies to both modes, and Cloud Dataflow runs the stages of the pipeline in parallel across multiple workers. This unified approach lets teams handle data cleaning, enrichment, aggregation, and stream joins with one codebase instead of separate batch and streaming systems.
Cloud Dataflow (opens in a new tab) is the serverless runner that executes Apache Beam pipelines for batch and stream processing at scale. A developer authors a pipeline composed of PCollections and transforms, and Dataflow distributes the stages across Compute Engine worker virtual machines (VMs) that run in a specified region. Because workers process in parallel, factors outside the pipeline code also bound scalability, including the scalability of external systems, the choice of data formats, and data location and network topology.
Using Google Cloud managed sources and sinks removes much capacity planning because those services provide built-in scalability and consistent performance.
A custom Apache Beam (opens in a new tab) pipeline is required when predefined execution paths cannot express the needed transformation logic. Built-in Dataflow templates are predefined Apache Beam pipelines deployed through a code-free job wizard, including templates for exporting Kafka data to Google Cloud. Choose a custom pipeline when integration needs an unsupported source or sink, or when records require transformations, normalizations, or mutations before delivery.
The choice between Kafka Connect and Dataflow follows the complexity and volume of the transformation:
| Option | Best use | Transformation capability |
|---|---|---|
| Kafka Connect with MirrorMaker 2.0 | Transfer between Kafka clusters, cluster migration, backup, and disaster recovery | Record-at-a-time, per-message modifications |
| Cloud Dataflow with Apache Beam | High-volume migration requiring complex stream operations before reaching the target Managed Service for Apache Kafka cluster | Data cleaning, enrichment, and aggregation, plus joining multiple streams |
The Managed Service for Apache Kafka (opens in a new tab) cluster is the downstream destination in the high-volume migration case, where Dataflow performs the complex operations before delivery.
Exam tip: Choose Dataflow when the work needs stream joins with windowing and alignment logic or aggregation and enrichment; choose Kafka Connect when the work is cluster transfer with only basic per-message changes.
Advanced windowing and alignment logic in Cloud Dataflow is what enables joining multiple data streams for complex correlation and aggregation. Data flows from two or more unbounded sources into the pipeline, where windowing groups elements by time so related records from different streams can be aligned and joined. This capability is essential when a result depends on combining events that arrive on separate streams over time, rather than transforming each message in isolation. Kafka Connect does not provide this multi-stream windowing and alignment, which is why it remains limited to basic per-message modifications.
Scalable aggregation in Apache Beam depends on how keys distribute work across Dataflow workers, and skewed hot keys create bottlenecks. When many elements share the same key, the worker that processes that key becomes overloaded while other workers stay idle. To resolve hot-key skew, rekey the data or add intermediate fanout so partial aggregation happens in parallel before the final combine.
Rekeying applies a ParDo transform to output new key-value pairs that spread load more evenly. Fanout uses combine variants that first partially aggregate across many workers and then combine the partial results. In the Java software development kit (SDK), use Combine.PerKey.withHotKeyFanout instead of Count.PerKey and use Combine.Globally.withFanout instead of Combine.Globally for high-volume unbounded PCollections. In the Python SDK, use the with_hot_key_fanout operation on CombinePerKey. Create libraries of reusable transforms so the same tested aggregation logic is shared between batch and streaming paths.
Enrichment that calls external services from a Cloud Dataflow pipeline incurs per-call overhead that can reduce performance and efficiency. Data flows from pipeline workers to the external service and back, and many native Beam input/output (I/O) transforms reduce this cost by batching multiple elements into single requests, including BigQueryIO and streaming insert operations. Because Dataflow parallelizes work, too much traffic can overwhelm the external service or exhaust quotas such as daily limits or requests-per-second limits.
The pipeline depends on the external system staying within sustainable load, so limit batch sizes and concurrent calls when the downstream service cannot scale. Autoscaling adds a tradeoff: Dataflow may add workers to compensate for a slow external-call step, and those added workers can place further pressure on the already overloaded system. Ensure the external system supports anticipated load or throttle the pipeline, and package shared enrichment and filtering logic into reusable transform libraries for consistent batch and stream behavior.
ETL versus ELT is a choice about where transformation compute happens in a pipeline. In extract-transform-load (ETL), data is transformed before it is loaded into the warehouse using programmatic engines such as Cloud Dataflow or Managed Service for Apache Spark. In extract-load-transform (ELT), raw data is loaded first into BigQuery (opens in a new tab) and then transformed declaratively with SQL inside the warehouse. The choice controls latency, scalability, operational overhead, and how diverse enterprise formats are handled.
Cloud Dataflow (opens in a new tab) is a fully managed, serverless service for running Apache Beam pipelines at scale for both batch and streaming data. Data flows from one or more sources through Beam transforms and then to a destination sink, using the same programming model for batch and stream. Beam provides windowing and session-analysis primitives plus source and sink connectors, including a connector for BigQuery, so streaming pipelines can ingest, process, and analyze fluctuating volumes of real-time data with low latency.
Dataflow pipelines run on a pool of worker virtual machines (VMs) that the Dataflow service allocates, autoscales, and deletes when the job completes or is cancelled. Dataflow distributes work in parallel across workers, dynamically rebalances work among VMs, detects and corrects stragglers, and provides centralized logging and a graphical monitoring interface with per-stage execution details. By default, Dataflow provides exactly-once processing of every record, while streaming pipelines that can tolerate duplicates can enable at-least-once mode to reduce cost and improve latency.
Beam pipelines are portable across runners and languages. Pipelines can be written with the Java, Python, and Go software development kits (SDKs), including multi-language pipelines, and can later run on Apache Flink or Apache Spark without rewriting pipeline code. Teams can submit jobs through the command-line interface or SDKs, develop iteratively in JupyterLab notebooks, or deploy Dataflow templates so a developer-built pipeline can be run on demand without Beam knowledge. Choose Dataflow ETL when transformation requires complex event-time logic, per-record enrichment, unified batch and streaming, or highly parallel fan-out across many cores.
Cloud Data Fusion is a fully managed data integration service, built on the open source CDAP project, for building ETL pipelines through a graphical interface without writing code. A developer connects sources to transformations, sinks, and other nodes to form a directed acyclic graph (DAG) in the Cloud Data Fusion UI. When the pipeline is deployed, the Cloud Data Fusion planner transforms the DAG into parallel computations that execute as an Apache Spark job on Managed Service for Apache Spark.
Cloud Data Fusion connects to diverse enterprise sources through prebuilt plugins and Java Database Connectivity (JDBC) drivers. Plugin types include sources, transforms, aggregates, sinks, error collectors, alert publishers, actions, and post-run actions, and a custom plugin can be built with the plugin APIs when no prebuilt plugin exists. To read from a source database, an operator uploads a JDBC driver to the instance, configures it, and then reads, transforms, and loads data into a destination such as BigQuery. Pipelines support both batch and streaming modes and expose logs and metrics so administrators can operationalize workflows without custom tooling.
For Spark-based batch ETL, processing typically lands in a data lake after transformation. The processed data is stored in Cloud Storage in columnar formats such as Parquet and ORC because those formats allow efficient storage and faster access for analytical workloads. Metadata about databases, tables, columns, and partitions is stored in the Hive metastore service supplied by Dataproc Metastore. Choose this pattern when the team needs visual development, broad JDBC and plugin connectivity, or Spark execution for heavy batch reshaping of files and tables.
Declarative ELT with BigQuery loads raw or lightly staged data first and then transforms it inside the warehouse with SQL. Transformations are written in GoogleSQL and can include data definition language (DDL) and data manipulation language (DML) statements that create tested, version-controlled datasets and tables. Dataform is a SQL-based transformation framework that schedules complex BigQuery transformation tasks, while scheduled queries provide the simplest time-driven scheduling for straightforward query chains with no external dependencies.
In ELT, BigQuery compute performs filtering, joining, aggregation, and modeling after the data is already durable in the warehouse. This design keeps raw history available for reprocessing and lets analysts work primarily in SQL and JavaScript rather than cluster code. It works best when inputs are already tabular or semi-structured and when transformation logic is set-based rather than per-event stateful streaming. Choose BigQuery ELT when transformation volume is large but logic fits SQL, when raw replay matters, and when minimizing pipeline code and cluster operations is more important than pre-load cleansing.
Orchestration for transformation pipelines decides when work starts and in what order dependent tasks run. Event-driven scheduling starts work on a state change, such as a file landing in a bucket or a message arriving in Pub/Sub, while time-driven scheduling starts work on a clock, such as once per day or hourly for reports. Pipelines often combine both, such as loading objects into a data lake in real time but generating activity reports daily.
Managed Airflow, formerly Cloud Composer, orchestrates multi-service ETL and ELT dependencies with Python DAG files stored in a Cloud Storage bucket. A typical batch Spark orchestration runs as an ordered workflow:
Other schedulers divide by workload shape. Dataform focuses on data transformation, Workflows chains HTTP-based microservices with very low latency, Managed Airflow focuses on ETL or ELT with complex dependencies, and Vertex AI Pipelines focuses on machine learning. Scheduled queries are not suitable for chains of external services, Workflows is not suitable for data transformation and processing, and Managed Airflow is not suitable for low-latency or event-driven pipelines.
Performance trade-offs for transformation architectures start with format, locality, and external dependencies. Data formats that support parallelizable reads, such as Avro, are usually faster than CSV files that have embedded newlines in fields and faster than compressed files. Geographic proximity and network topology between sources, pipeline workers, temporary files, and sinks also affect performance, and data sent across regions can add latency when file locations sit outside the job region.
External service calls add per-call overhead that can limit throughput, and quotas on calls per second or per day can throttle a parallel pipeline. Native Beam I/O transforms such as BigQueryIO batch elements automatically, and pipelines should batch multiple elements into single requests where possible. Because Dataflow parallelizes work and autoscaling can add workers to a slow external-call step, added workers can further pressure the external system unless traffic is limited to sustainable levels.
Using Google Cloud managed sources and sinks removes much capacity management because Pub/Sub and BigQuery provide scalable ingestion and storage with quotas that fit most requirements. Multiple pipelines can read from one Pub/Sub topic through separate subscriptions, which lets each Dataflow pipeline pull and acknowledge independently, supports replica pipelines for high availability, and allows test pipelines to run against the same data. Dataflow still depends on sufficient Compute Engine quota, since insufficient quota can prevent jobs from starting or block autoscaling. Apache Beam (opens in a new tab) pipeline planning must therefore account for source, sink, network, and quota limits in addition to transform logic.
| Architecture | Transformation location | Best fit |
|---|---|---|
| Cloud Dataflow | Transform in flight in Beam workers before BigQuery load | Streaming enrichment, windowing and sessions, highly parallel workloads, exactly-once needs |
| Cloud Data Fusion and Spark | Transform in Spark from visual DAG before warehouse or lake load | No-code integration, JDBC sources, batch reshaping into Parquet or ORC with Dataproc Metastore |
| BigQuery ELT | Load raw first, transform with SQL, Dataform, or scheduled queries | Large set-based SQL modeling, raw replay, analyst-owned pipelines with minimal cluster code |
Exam tip: Use Dataflow when the documentation requires unified batch and streaming with exactly-once processing by default; use BigQuery SQL and Dataform when raw data is already loaded and the transform is declarative and time-driven.
Use Cloud Composer for scheduled, multi-step data orchestration as Apache Airflow directed acyclic graphs (DAGs) spanning cloud and on-premises systems, Workflows for lightweight, event-driven coordination of HTTP-based APIs and microservices, and Cloud Data Fusion for extract, transform, load (ETL) or extract, load, transform (ELT) pipeline development with drag-and-drop sources and sinks. Composer reaches processing engines through operators such as BigQuery and Dataflow operators, while Workflows reaches services through connectors and direct HTTP calls.
Use Kafka Connect with MirrorMaker 2.0 for transfer between Kafka clusters, cluster migration, backup, and disaster recovery with only record-at-a-time, per-message modifications. Use Cloud Dataflow with Apache Beam for high-volume migration requiring complex stream operations before delivery to the target Managed Service for Apache Kafka cluster, including data cleaning, enrichment, aggregation, and joining multiple streams with windowing and alignment logic.
Hot-key skew is resolved by rekeying the data or adding intermediate fanout so partial aggregation happens in parallel before the final combine. Rekeying uses a ParDo transform to output new key-value pairs that spread load more evenly, while fanout uses combine variants that first partially aggregate across many workers and then combine the partial results.
A data engineering team is designing a streaming pipeline using Apache Beam running on Cloud Dataflow to process financial transactions and sink transformed account balances into Google Cloud Spanner.
During disaster recovery and worker failure testing, the team observes that pipeline tasks retry and fail with com.google.cloud.spanner.SpannerException: ALREADY_EXISTS exceptions, causing the Dataflow job to crash.
Which mutation strategy should the team implement in their Apache Beam transformation logic to ensure resilient and idempotent writes to Cloud Spanner?
Last updated