Prepare and test your skills

Prepare and test your skills

Implementing and managing resource allocation and autoscaling policies means sizing compute and storage to business needs and letting the platform add or remove capacity as demand changes. Elastic compute comes from Compute Engine (opens in a new tab), Cloud Run (opens in a new tab), Dataflow, Managed Service for Apache Spark, and BigQuery, while cost control comes from Cloud Storage, Persistent Disk, and Cloud Monitoring with billing alerts. The goal is to meet performance and reliability objectives without paying for idle resources.
Right-sizing means matching machine shape and container size to the actual workload before enabling elasticity. Compute Engine provides machine type recommendations that analyze CPU and memory use and suggest a smaller or better-fitted machine type, and custom machine types let teams provision CPU cores independently of memory when a workload needs more of one than the other. For container jobs on Cloud Run, charges are based on on-demand CPU, memory, and request count, so teams should start with default CPU and memory limits and increase them only after observing performance. The same principle applies to specialized processors: analyze workload patterns to avoid overprovisioning Document AI processors and pre-process documents to remove unnecessary pages and lower resolution.
Right-sizing also includes separating the data storage layer from the data computation layer. The storage layer holds bytes in systems such as Cloud Storage, BigQuery storage, Cloud SQL, Spanner, or Bigtable, while the computation layer loads data from storage, processes it, and writes results back. Keeping the layers on separate platforms in the same zone and region reduces communication latency, outbound transfer cost, and I/O operations, and it avoids paying to keep compute running when only storage is needed. For example, data can remain in Cloud Storage while a Managed Service for Apache Spark cluster runs only for the duration of the batch job.
Autoscaling automatically adds capacity when load rises and removes it when load falls, which handles traffic gracefully while reducing cost during quiet periods. Autoscaling in Compute Engine applies to stateless managed instance groups (MIGs), where the autoscaler creates or deletes virtual machine (VM) instances based on utilization; stateful MIGs cannot be autoscaled because each instance preserves unique state. Cloud Run scales regional services automatically and load-balances traffic across multiple zones in the region, so a zone outage does not lose data or stop jobs, while a region outage pauses jobs until Google resolves it. For background worker pools, Cloud Run External Metrics Autoscaling (CREMA) performs a ratio-based calculation that measures CPU utilization over a time window from Prometheus metrics and compares it against a configured threshold to raise or lower the instance count.
Exam tip: Stateless MIGs support autoscaling to save cost when demand is low, while stateful MIGs cannot be autoscaled.
Autoscaling choices involve cost and availability tradeoffs. Spot VMs cost significantly less than regular VMs and offer the same machine types and performance, but Compute Engine can preempt them to reclaim capacity, and a MIG may be unable to scale out to its target size when zonal capacity is limited. Spot VMs therefore fit fault-tolerant batch jobs without high-availability requirements, not latency-sensitive pipelines with strict service level objectives (SLOs). Individual Cloud Run jobs can also fail, so task retries and checkpointing are used to resume work without re-running the entire job.
Capacity planning estimates how much infrastructure a data workload needs and ensures that capacity will actually be available. Forecasting starts with demand signals:
Based on that forecast and the architecture, teams estimate the quantity of resources, such as MIG size, VM machine type, and number, type, and size of persistent disks, and use the Google Cloud Pricing Calculator to estimate cost. Adequate redundancy is then added, for example N+1 redundancy where every component has at least one spare beyond the minimum needed to carry forecast load.
Capacity must be validated and protected in an ordered workflow:
Availability targets directly affect this plan. Choosing services with uptime service level agreements (SLAs) that support the required overall uptime matters because 99.9% availability allows about 86 seconds of downtime per day, while 99% allows about 864 seconds, or ten times more. Higher availability generally costs more in redundancy, multi-zone replication, and operational complexity, so the design must balance availability, latency, complexity, and cost against regulatory and business needs.
The choice of VMs, containers, or serverless controls how much tuning is possible versus how much infrastructure must be managed. VMs and containers allow detailed configuration, but the team remains responsible for managing the resources, while serverless runs on a preconfigured platform with minimal management effort.
| Hosting option | Configuration flexibility | Management responsibility |
|---|---|---|
| VMs on Compute Engine | High, including custom machine types and simultaneous multithreading (SMT) settings | Team manages VMs, patching, scaling, and availability |
| Containers on Google Kubernetes Engine (GKE) | High, with automated deployment, scaling, and management of containerized apps | Team manages clusters and workloads, platform automates orchestration |
| Serverless on Cloud Run | Lower, deployed to a preconfigured platform with CPU and memory limits | Minimal, platform manages provisioning, load balancing, and scale to demand |
Choose VMs when third-party licensing or operating-system access requires control, such as bringing your own license (BYOL) for Windows Server with a custom image to pay only for infrastructure, limiting cores with custom machine types, or disabling SMT to reduce vCPUs per core from 2 to 1. Choose GKE when workloads are containerized and need orchestration across zones, including regional clusters that tolerate zone outages. Choose Cloud Run when the priority is focusing on data and application logic rather than operating infrastructure.
Tiered storage controls cost by placing data in the class that matches retention and access frequency. Cloud Storage offers Standard, Nearline, Coldline, and Archive classes, where Nearline, Coldline, and Archive cost less for infrequently accessed data, so buckets should use the class that matches retention and access frequency. Lifecycle policies then automatically transition objects to lower-cost classes or delete them based on age and access patterns, which prevents paying Standard prices for aging pipeline outputs, logs, and intermediate files.
Durability and performance choices also change cost. Data in regional buckets is replicated synchronously across zones in the region, while dual-region and multi-region buckets store data redundantly in at least two locations with synchronous metadata writes and asynchronous data replication. Dual-region buckets can use turbo replication for a 15-minute recovery point objective (RPO) across the region pair. For block storage, zonal Persistent Disk is lowest cost, regional Persistent Disk and Hyperdisk Balanced High Availability synchronously replicate between two zones for zone-outage resilience, and Hyperdisk Balanced allows independent, dynamic provisioning of input/output operations per second (IOPS) and throughput to tune cost to the workload. Shared file data across VMs in a region can use a Filestore regional instance, which synchronously replicates across three zones.
Budgets, quotas, and alerts form the guardrail that keeps autoscaling from creating cost overruns while still meeting SLOs. Google Cloud quotas cap resource creation and API request rates, reservations guarantee that critical capacity exists, and Cloud Monitoring with billing alerts sends notifications when usage exceeds thresholds. Regular cost reports in the Google Cloud console reveal trends in CPU, memory, storage, token use for large language models (LLMs), and network bandwidth, such as caching frequently accessed Firestore data or minimizing index entries through efficient data modeling. When a threshold breach signals sustained growth rather than a spike, teams adjust autoscaling maximums, storage lifecycles, or machine shapes instead of simply raising the budget.
Predictable workloads can then shift from on-demand to discounted pricing. Committed use discounts lower the price for Cloud Run and other compute when CPU and memory needs can be predicted for a term, which rewards accurate forecasting and benchmarking. Spot VMs provide the opposite tradeoff of low price without a commitment but with preemption risk. Together, right-sizing, autoscaling with maximums, quota limits, reservations for critical jobs, monitoring and alerts, and committed discounts let data workloads expand and contract with demand while staying within the required business budget.
Cost-effective storage and processing architecture means matching where data sits and how it is computed to how often data is accessed, how fast results are needed, and how bursty the workload is. Cloud Storage (opens in a new tab) holds objects across classes such as Standard, Nearline, Coldline, and Archive, while processing can run on self-managed VMs, Google Kubernetes Engine (GKE), Cloud Data Fusion, Managed Service for Apache Spark, Dataflow (opens in a new tab), and BigQuery. The lowest total cost comes from placing cold data in colder classes, colocating compute with data in the same region, and replacing always-on clusters with autoscaled or ephemeral managed execution that scales with data volume.
Storage class selection controls cost because retrieval and operation charges rise when cold data is accessed like hot data. Storage Intelligence advisor surfaces a Spike in Class A or B operations on Coldline or Archive data finding when objects in Coldline storage or Archive storage are read frequently, which indicates the data is better suited for Standard storage or Nearline storage intended for frequent access. Time-series charts for cumulative object count and storage volume over time track object growth across locations and storage classes, so growth in colder classes can be checked against actual access frequency. Centralized oversight across projects, folders, or organizations replaces custom reporting pipelines, BigQuery scripts, and external visualization tools for this review.
Storage spend grows from retained versions, wrong classes, and cross-region movement, and three controls address each driver. Object Lifecycle Management and Autoclass handle retention and class placement, while bucket relocation handles location, so each cost driver has a matching automatic control.
When total bytes stored increases above the 30-day trend, the cause is often indefinite retention of noncurrent versions after new uploads, so lifecycle deletion or Autoclass transition directly reduces the billed volume. Bucket relocation colocates Cloud Storage buckets with Google Cloud compute resources in the same region to resolve cross-region egress, such as a Compute Engine instance in us-central1 frequently accessing a bucket in us-east1.
The rewrite decision balances migration effort against ongoing run cost and maintainability. Lift-and-shift keeps an existing extract, transform, load (ETL) platform and changes storage stages to BigQuery, which is fastest when the vendor tool already supports BigQuery and licenses are already held. Rewrite to Google Cloud-managed services fits when pipelines use deprecated technologies or when porting and maintaining them unmodified would be impractical or cost prohibitive. Cloud Data Fusion, built on the open source CDAP project, supports rewrite through a graphical interface where sources connect to transformations, sinks, and other nodes to form a directed acyclic graph (DAG), and the planner transforms that DAG into parallel computations executed as an Apache Spark job on Managed Service for Apache Spark.
Task farming scales third-party pipeline software without vendor-native distribution by fanning work across VMs. In this pattern, each VM in a managed instance group (MIG) runs the third-party pipeline software and a simple agent, and all trigger methods send a message to a predefined Pub/Sub topic. The agent pulls a message from the topic, starts a pipeline in the third-party software, waits for completion, and then retrieves the next message, so data flows from Cloud Scheduler, Managed Service for Apache Airflow, a Cloud Storage trigger, a Cloud Endpoint, a Cloud Function, or the Pub/Sub API through Pub/Sub topics to agents on MIG VMs. If the vendor supports Kubernetes, the middle-ground option installs the software on a GKE cluster to use vendor-native support for Kubernetes task parallelization, but the team must still create and manage the GKE cluster.
A single-pipeline Dataflow design removes the external orchestration and intermediate materialization that make task farms expensive to run. A highly parallel workload typically follows an ordered sequence:
Dataflow, based on Apache Beam, runs all four stages in one DAG and one pipeline, so a single system owns every stage and no external orchestrator coordinates multiple pipelines. Because data stays in the system with data locality, stages do not explicitly materialize and dematerialize between boundaries, in-system telemetry exposes total bytes per stage for later-stage design, and autoscaling scales resources as data volumes move through stages. Migrating from task farming requires shifting from tasks to data, where a PTransform contains a DoFn whose process function takes one data element, and parallel branches rejoin through side-inputs or joins under the Dataflow Runner for Apache Beam.
BigQuery I/O choices affect pipeline runtime, quota consumption, and therefore processing cost. BigQueryIO in Apache Beam supports two read paths, and the choice determines whether data flows through temporary Cloud Storage or directly from BigQuery to the pipeline.
| Read method | How data moves | Quota and runtime effect |
|---|---|---|
| EXPORT | Pipeline sends a BigQuery export request, BigQuery writes table data to temporary Cloud Storage, then pipeline reads from that temporary location | Consumes BigQuery export quotas and adds runtime because the export must complete before processing starts |
| DIRECT_READ | Pipeline reads table rows directly from BigQuery through the BigQuery Storage API over gRPC | Avoids export quota restrictions and potentially decreases job run time with high-throughput direct reads |
EXPORT is the default read method, so pipelines that can tolerate its extra step keep default behavior while pipelines sensitive to quota or runtime choose DIRECT_READ. Writes follow the same quota logic: batch pipelines that use BigQuery load jobs consume BigQuery load job quotas at table and project level, while streaming pipelines that use streaming inserts consume streaming insert quotas. Data flows from batch sources through load jobs to BigQuery tables for infrequent bulk loads, while data flows from streaming pipelines through streaming inserts or the Storage Write API to BigQuery tables for near real-time appends.
Exam tip: Avoid using BigQuery load jobs to append data thousands of times per day into a table; use a streaming pipeline with streaming inserts or the Storage Write API instead.
Region placement and burst strategy determine whether the team pays for idle capacity or only for peak use. Dataflow region selection considers the location of data sources and sinks, preferences or restrictions on processing location, features offered only in specific regions, the region used to manage job execution, and the zone used for job workers, and the job region and worker zone can differ. Choosing regions near sources and sinks reduces egress and latency, while planning regions around high availability and geographic redundancy supports disaster recovery without duplicating always-on capacity.
The cloud bursting pattern (opens in a new tab) keeps baseline load on a private computing environment and bursts to Google Cloud temporarily when extra capacity is needed. Data flows from the on-premises private environment to the Google Cloud environment only in burst mode when local capacity is at its limit, so the organization pays for on-demand cloud resources only while handling extra load instead of overprovisioning a data center or stretching time-sensitive batch jobs over longer periods. Workload portability is required because the same workload must deploy across environments, and Kubernetes provides consistency at the workload level across different infrastructures even though compute, security, networking, and proximity to dependent services still affect performance. For interactive workloads, traffic flows from clients through either an on-premises load balancer that tracks cloud resources and scales them up and down, or through Cloud Load Balancing with hybrid connectivity network endpoint group (NEG) backends that split traffic by weight and scale Google Cloud backends on serving capacity.
Monitoring, analyzing, and optimizing data pipeline efficiency is the continuous practice of detecting wasteful spend, attributing cost to its business owner, and rightsizing resources without breaking performance or reliability goals. In Google Cloud, Cloud Monitoring (opens in a new tab) and Cloud Logging expose utilization and performance signals, Cloud Billing (opens in a new tab) reports and billing exports to BigQuery expose spend signals, and product-specific controls adjust compute, storage, and network consumption to match actual demand.
Cloud Monitoring is the service that collects metrics from applications, infrastructure, and managed services such as Compute Engine, Google Kubernetes Engine (GKE), and Cloud Run functions. Metrics flow from the monitored resources to prebuilt dashboards or to custom dashboards that track pipeline-specific indicators such as CPU and memory utilization, API calls, throughput, latency, and error rates. Cloud Logging provides centralized collection and storage of logs from the same sources, and log data flows from the workload to Cloud Logging where it can trigger real-time alerts on cost or performance anomalies.
Analysis in these tools focuses on three costly patterns. Over-provisioning occurs when allocated CPU, memory, storage, or accelerators sit unused and creates unnecessary cost, while under-provisioning creates bottlenecks that slow training, queries, or serving. Idle or underutilized VMs and GPUs should be shut down or rightsized, and sudden cost spikes should be investigated as unexpected increases in usage or inefficient queries. Correlating utilization with application performance determines whether a pipeline can move to a smaller machine type or fewer replicas without degrading user experience.
Use Active Assist, a portfolio of intelligent tools that includes Recommender, to systematize this detection at no additional cost and without configuration. Active Assist analyzes utilization history across Cloud Run, BigQuery, Compute Engine, and Cloud SQL to surface idle resources, idle VM recommendations, machine-type rightsizing opportunities, and underutilized commitments. For GKE, detailed cost allocation breakdowns and cost-optimization metrics show spend by workload so cluster autoscaler behavior and pod requests can be tuned to actual demand.
Cloud Billing is the collection of tools that tracks current spend, forecasts trends, and supports chargeback through reports, budgets, and exports. Billing data flows from metered resource usage to built-in Cloud Billing reports and the FinOps hub for at-a-glance breakdowns, and detailed billing data can be exported to BigQuery where custom SQL queries aggregate cost by label, project, service, or time period. That export path enables attribution of spend to specific data activities such as ingestion, transformation, model training, hyperparameter tuning, or inference.
Raw spend becomes actionable only after it is enriched with ownership and purpose. A consistent hierarchy of organizations, folders, and projects separates environments, while labels and tags attach business metadata such as team, cost center, environment, dataset, or pipeline name to each resource. Labels enable cost breakdowns by label in billing analysis, tags support audits and allocation, and automation with tools such as Terraform enforces labeling at creation to prevent untagged spend. Custom dashboards built with Looker or Looker Studio on top of the BigQuery export then connect cloud cost to revenue, adoption, accuracy, or other business metrics.
Continuous cost control depends on budgets, alerts, and anomaly detection operating in order. First, budgets track actual cost against planned cost and send notifications when thresholds are exceeded. Then, alerting policies in Cloud Monitoring notify owners when key performance indicators cross defined limits, and log-based alerts surface cost issues in real time. Finally, the anomaly detection dashboard in Cloud Billing and analytic queries in BigQuery identify unexpected spikes that scheduled reports might miss.
Optimized data pipelines align resource allocation with workload demand through rightsizing, autoscaling, lifecycle management, and network-aware placement. Rightsizing adjusts provisioned capacity to observed use, and custom metrics plus threshold alerts allow administrators to scale promptly when utilization indicates waste or pressure. Autoscaling then adjusts capacity dynamically so pipelines pay for peak only during peak and avoid paying for idle capacity between peaks.
Google Cloud provides distinct autoscaling controls for different compute shapes. Compute Engine managed instance groups scale VMs as a single entity under policies that define minimum and maximum size and CPU-based triggers. GKE combines Cluster Autoscaler, which adds or removes nodes based on Pod demand, Horizontal Pod Autoscaler, which changes replica count on CPU, memory, or custom metrics, Vertical Pod Autoscaler, which tunes requests and limits, and node auto-provisioning, which creates optimized node pools. Cloud Run provides built-in serverless scaling where instance count follows incoming traffic upward under load and downward to reduce cost when traffic falls.
Storage and movement optimizations reduce the other two major data costs: retained bytes and transferred bytes. Data lifecycle processes delete unneeded data, aggregate detailed data before long-term retention, and move infrequently accessed data to lower-cost classes, with Cloud Storage supporting automation through Object Lifecycle Management and Autoclass, which transitions objects based on access patterns. Network pricing requires explicit review because cross-region egress and external load balancer data transfer add cost on top of compute and storage, so region selection must balance cost against latency, compliance, and sustainability, and caching or edge controls can lower external transfer for repeated reads.
Exam tip: Choose Spot VMs for fault-tolerant batch work that tolerates preemption at more than 80% lower cost than regular VMs, and choose committed use discounts for steady, predictable data workloads with a one-year or three-year commitment.
Sustained efficiency requires pairing technical optimizations with pricing commitments and provisioning guardrails. Committed use discounts (CUDs) lower the billing rate in exchange for committed usage, sustained use discounts apply automatically after continuous Compute Engine and GKE usage passes duration thresholds, and BigQuery offers on-demand pricing for variable queries alongside edition-based pricing with commitments and autoscaling for high-volume analytics. BigQuery slot commitments and the appropriate edition reduce cost per slot when query volume is significant and predictable, while on-demand remains simpler for sporadic exploration.
Governance prevents savings from eroding as footprints grow. The implementation order is first monitor costs with billing reports and BigQuery exports, then control provisioning with infrastructure as code, mandatory reviews before substantial changes, drift detection with asset inventory, organization policies, and quotas that cap regional usage, and finally reduce cost through discounts, decommissioning, rightsizing, autoscaling, managed-service migration, and lifecycle automation. An iterative loop sustains the result:
Pricing models and features change over time, so regular review of editions, regions, and new efficiency features keeps architecture aligned with both technical requirements and financial objectives.
Use Spot VMs for fault-tolerant batch jobs without high-availability requirements and use committed use discounts (CUDs) for steady, predictable workloads with a one-year or three-year commitment. Spot VMs cost significantly less than regular VMs with the same machine types and performance at more than 80 percent lower cost, but Compute Engine can preempt them to reclaim capacity. Committed use discounts (CUDs) lower the billing rate in exchange for committed usage, which rewards accurate forecasting and benchmarking.
Stateless managed instance groups (MIGs) support autoscaling while stateful managed instance groups (MIGs) cannot be autoscaled. In stateless managed instance groups (MIGs) the autoscaler creates or deletes virtual machine (VM) instances based on utilization to handle traffic gracefully while reducing cost during quiet periods, whereas each stateful instance preserves unique state so it cannot be automatically added or removed.
EXPORT moves data through temporary Cloud Storage while DIRECT_READ reads table rows directly from BigQuery through the BigQuery Storage API over gRPC. EXPORT is the default read method where the pipeline sends a BigQuery export request, BigQuery writes table data to temporary Cloud Storage, then the pipeline reads from that location, which consumes BigQuery export quotas and adds runtime because the export must complete before processing starts. DIRECT_READ avoids export quota restrictions and potentially decreases job run time with high-throughput direct reads.
Object Lifecycle Management and Autoclass control cost by placing data in the class that matches retention and access frequency across Standard, Nearline, Coldline, and Archive. Object Lifecycle Management deletes noncurrent versions or transitions objects to colder classes to stop indefinite retention from increasing total bytes stored, which prevents paying Standard prices for aging pipeline outputs, logs, and intermediate files. Autoclass automatically moves objects between classes as access patterns change without maintaining custom lifecycle rules for every prefix.
Your data engineering team is analyzing BigQuery query plans and Cloud Billing reports. They notice that analytics queries against a highly normalized snowflake schema are incurring high costs and slow performance due to massive join operations and full table scans on specific date and region columns.
You need to minimize query costs and optimize performance for these analytical workloads.
Which optimization strategy should you implement?
Last updated