Prepare and test your skills
Prepare and test your skills
Evaluating workload characteristics for service selection is the process of matching traffic patterns, resource use, and execution duration to the lowest-cost compute service. Google Kubernetes Engine (GKE) (opens in a new tab), Cloud Run, and Compute Engine have different pricing models, scaling behavior, and operational overhead, so the same workload can cost very different amounts on each platform. The goal is to avoid paying for idle capacity while keeping performance stable during bursts, volatility, and predictable low-use periods.
Traffic patterns and execution duration describe how demand arrives over time and how long compute must stay allocated to serve it. Cloud Run runs code without managing infrastructure and adjusts instances automatically as incoming traffic rises and falls, which reduces cost when traffic is variable, bursty, or idle for long periods. Compute Engine with managed instance groups (MIGs) maintains a defined minimum and maximum number of virtual machines (VMs) and adds VMs when utilization such as CPU reaches a threshold and removes VMs when it drops below a different threshold, which fits steady or slowly changing demand that benefits from always-available capacity. Google Kubernetes Engine (GKE) dynamically adjusts cluster resources through complementary autoscalers, which fits containerized workloads with mixed or evolving demand where both Pod count and node capacity must change together.
Workload duration and predictability further narrow the choice because discounts reward different usage shapes. Predictable and steady usage aligns with committed use discounts (CUDs) that exchange a one-year or three-year commitment for significant price reductions, while continuous but uncommitted Compute Engine and GKE usage can earn automatic sustained use discounts after duration thresholds. Fault-tolerant and flexible work such as batch jobs that tolerate preemption aligns with Spot VMs, which provide unused VM capacity at more than 80% lower cost than regular VMs but can be preemptively stopped or deleted to reclaim capacity. Regular review of pricing models matters because new features and regions can change the tradeoff between cost, latency, and compliance requirements.
Resource consumption and application state describe how much CPU and memory a workload needs, whether usage is stable or spiky, and whether instances must retain identity or data. Stateful applications store client, session, or transaction data such as shopping-cart contents until it is no longer needed, while stateless applications close the session after serving the request and can be replaced or scaled more freely. Assessment questions include whether instance-specific metadata must survive reboot or autoheal recreation, whether VMs need a mix of machine types or images such as memory-optimized versus general-purpose, whether all VMs can run in one zone, virtual private cloud (VPC) network, and subnet, and whether the application needs low-latency proximity to a database.
GKE provides signals for matching requests to actual consumption through workload rightsizing insights. A workload is underprovisioned when CPU or memory utilization exceeds 150% for at least 10% of the time over the last 15 days, and the recommendation is to scale up for reliability. A workload is overprovisioned when CPU or memory utilization is below 50% for at least 90% of the time over the last 15 days, and the recommendation is to scale down to save cost. GKE does not generate a recommendation for the target metric of Horizontal Pod Autoscaler, does not generate one when Vertical Pod Autoscaler already manages requests automatically, and may wait up to three days for new workloads. Cost or savings estimates use the weighted average of request values combined with CPU and memory cost over the past 30 days and require the billing.accounts.getSpendingInformation permission with GKE cost allocation enabled.
Operational overhead and autoscaling fit determine how much platform management the team accepts in exchange for control and bin-packing efficiency. Cloud Run removes node, cluster, and VM management because built-in autoscaling moves capacity directly with incoming traffic from scale-up under load to scale-down when traffic decreases. Compute Engine MIGs treat a group of VMs as a single entity with autoscaling policies, which preserves full VM control but leaves image, machine type, update rollout, failure handling, and zone placement with the operator. GKE sits between them by orchestrating containers across shared nodes, where efficient packing of multi-tenant clusters can improve utilization and simplify control, but requires correct tuning of autoscaling, machine types, and region selection to avoid instability and over-provisioning.
The four GKE autoscaling tools divide scaling work by layer and work together to match supply to Pod demand:
This order matters because replica demand comes first, then Pod sizing, then node capacity, then pool shape. When applications are unstable during scaling, common causes include missing resource requests and limits, incorrect probes, and metrics gaps, which lead teams to over-provision CPU and memory far above daytime use as a workaround.
The most cost-effective service is the one where workload shape, state, and management needs align with pricing and control without paying for idle capacity. Steady-state container fleets with diverse tenants benefit from GKE consolidation plus cluster and Pod autoscaling, variable request-driven services benefit from Cloud Run scale-to-demand without node management, and VM-centric or specialized workloads benefit from Compute Engine MIGs with threshold-based scaling and machine-type control.
| Service | Best-fit workload shape | Pricing and control tradeoff |
|---|---|---|
| Google Kubernetes Engine (GKE) | Multiple containerized services with mixed CPU and memory needs and variable replica demand | Shared nodes improve bin-packing, but team must tune Pod requests, autoscalers, machine types, and regions |
| Cloud Run | Stateless, request-driven code with bursty or idle-prone traffic | Pay for serving instances as traffic scales up and down with no infrastructure to manage, but less control over underlying VMs |
| Compute Engine | Stateful, specialized, or zone-sensitive VMs needing specific images, machine types, or failure handling | Full VM control with MIG min/max and CPU-threshold scaling, but higher operational overhead and risk of idle VMs |
Cost attribution completes the decision because labels, budgets, and dashboards reveal whether the selected service stays efficient after deployment. Labels by project, department, or cost center let Cloud Billing and Cost Management break down spending, forecast trends, and identify high-use resources, while budgets and alerts notify owners when spending exceeds thresholds. Teams should decommission idle resources, rightsize over-provisioned VMs and workloads using observability and machine-type recommendations, derive daily or weekly demand patterns for proactive scale-up and scale-down, and move low-priority work to cheaper runtimes such as Spot VMs when preemption is acceptable.
Exam tip: Choose committed use discounts for predictable steady usage, sustained use discounts for continuous uncommitted Compute Engine and GKE use, and Spot VMs only for fault-tolerant flexible workloads that tolerate preemption.
Optimize Operational Patterns and Lifecycle Management is the practice of matching running capacity to real demand across the workload lifecycle so idle resources do not consume budget or energy. Google Cloud workloads use autoscaling to add capacity when load rises and remove it when load falls, Spot VMs (opens in a new tab) to run interruptible work on unused capacity at a steep discount, and proactive scheduling and cleanup to shut down or reshape what is not needed. Together these patterns prevent over-provisioning while keeping performance stable during volatility, bursts, and off-peak hours.
Compute Engine managed instance groups (MIGs) are groups of virtual machines (VMs) that are managed and scaled as a single entity. An autoscaling policy for a MIG defines the minimum and maximum number of VMs to maintain and the conditions that trigger scaling, such as adding VMs when CPU utilization reaches an upper threshold and removing VMs when utilization drops below a lower threshold. Traffic flows from the load balancer to the VMs in the group, and the autoscaler adds or removes VMs from the group based on load signals. Choose MIG autoscaling when the workload runs directly on VMs and needs horizontal scaling with explicit bounds and metric thresholds.
Google Kubernetes Engine (GKE) dynamically adjusts cluster resources to match application needs through four complementary autoscaling tools that operate at different layers. Pod demand drives node decisions, and resource requests and limits determine whether Pods fit on existing nodes or require new nodes:
These GKE tools work together to optimize utilization, preserve performance, and simplify management. GKE packs containers onto nodes with bin packing to maximize use of each node, while Horizontal Pod Autoscaler (HPA) handles replica count and Vertical Pod Autoscaler (VPA) handles container size; GKE multidimensional Pod autoscaling configures HPA and VPA simultaneously for complex workloads to minimize footprint for the required performance. For variable loads, configure scaling on application-specific signals such as queue depth for asynchronous tasks, request latency, or custom application metrics instead of CPU alone, and define clear scale-up and scale-down policies to prevent frequent, unnecessary scaling or flapping.
Cloud Run is a serverless platform that runs code without managing infrastructure and provides built-in autoscaling based on incoming traffic. When request volume increases, Cloud Run scales up the number of container instances to handle the load, and when traffic decreases, Cloud Run scales down instances to reduce cost and energy use. When a Cloud Run service receives no traffic, it scales to zero instances by default, so resources are powered only while they actively process requests. Choose Cloud Run autoscaling for intermittent, event-driven, or highly variable services where paying for idle servers would be waste, including GPU workloads that should consume GPUs only during use.
Spot VMs provide access to unused Compute Engine capacity at a significantly lower price than regular VMs, more than 80% cheaper in typical cases. The tradeoff is preemptibility: Compute Engine may preemptively stop or delete Spot VMs to reclaim capacity, so the workload depends on spare capacity that can disappear. Traffic or jobs therefore flow from a fault-tolerant queue or controller to Spot VMs for execution, with on-demand VMs or on-demand GKE nodes as fallback when Spot capacity is reclaimed. Choose Spot VMs when the work tolerates interruption and lacks high-availability requirements, such as large batch jobs, parallelized data processing, and noncritical background tasks that can be consolidated, retried, or shut down when not needed.
Exam tip: Spot VMs lower the price of interruptible capacity but can be preempted, while committed use discounts (CUDs) lower the price for predictable steady usage over one to three years.
Lifecycle optimization combines reactive scaling that responds to real-time load changes with proactive scaling that anticipates known demand from observed patterns. Google Cloud Observability data flows into demand models that reveal daily business hours, weekly report generation, and spikes such as sales events, and those models then drive scheduled autoscaling that pre-provisions resources before the peak and scales them down afterward. Design applications as stateless where possible by storing session state outside the compute instance, such as in Memorystore for Redis, so any instance can handle any request and horizontal scaling stays seamless.
Proactive cleanup and placement complete the lifecycle and prevent slow growth of waste:
| Option | What scales | Scaling signal and behavior |
|---|---|---|
| Compute Engine managed instance groups (MIGs) | VM count within min and max bounds | CPU or load thresholds add VMs on rise and remove VMs on fall |
| Google Kubernetes Engine (GKE) | Pod replicas, Pod size, nodes, and node pools | Pod demand and CPU, memory, or custom metrics drive HPA, VPA, Cluster Autoscaler, and Node Auto-Provisioning together |
| Cloud Run | Container instances, including scale to zero | Incoming request traffic scales instances up on load and to zero on idle |
The options compose by layer: Cloud Run handles serverless request concurrency automatically, GKE coordinates Pod and node elasticity for containerized services and batch jobs, and MIGs provide explicit VM-group control for VM-based workloads.
Implementing and tuning resource configuration for efficiency means matching vCPUs, memory, and disks to measured demand and then lowering the billing rate on the remaining steady usage. Compute Engine (opens in a new tab), Google Kubernetes Engine (GKE), and Cloud Run each expose different sizing controls, but all depend on the same loop where utilization data flows from workloads to observability tools to a resizing or discount decision. Over-provisioning wastes spend on idle capacity, while under-provisioning creates bottlenecks that hurt performance and user experience.
Right-sizing is the continuous practice of monitoring actual use and adjusting allocation to match demand. Cloud Monitoring provides real-time visibility into CPU, memory, and other utilization metrics so usage patterns and inefficiencies become visible over time. Recommender analyzes that history and produces intelligent recommendations such as machine-type changes for Compute Engine instances, idle VM findings, and idle-resource findings that identify unused capacity for decommissioning. Custom metrics extend this loop to application-specific signals, and alerts notify administrators when a threshold is met so allocation can be adjusted before cost or performance drifts.
Rightsizing decisions depend on workload context, not on raw utilization alone. Batch processing workloads may intentionally sustain high utilization for cost efficiency, so a highly utilized batch workload flagged as underprovisioned does not need to be scaled up if its allocation already meets the job. Java Virtual Machine (JVM)-based workloads on GKE need extra scrutiny because GKE has limited visibility into actual memory use inside the JVM. Cost estimates for GKE rightsizing are projections based on the weighted average of request values combined with CPU and memory cost over the past 30 days, and viewing them requires GKE cost allocation to be enabled and the billing.accounts.getSpendingInformation permission.
Tuning in Compute Engine centers on selecting the machine shape and removing idle capacity. Custom machine types let a VM be sized with the exact vCPU and memory ratio a workload needs instead of accepting a predefined shape, and machine-type recommendations identify overprovisioned instances that can move to a smaller or more cost-effective type. Idle VM and idle-resource recommendations identify instances and attached resources that are no longer needed, and decommissioning them removes both compute and disk cost. Because pricing models change over time, regularly reviewing instance types and regional pricing keeps the chosen shape aligned with current performance and cost tradeoffs.
Tuning in GKE centers on Pod requests and limits because requests drive scheduling and cluster scaling. Vertical Pod Autoscaler (VPA) fine-tunes Pod resource requests and limits from observed usage patterns, while manual adjustment applies the same change directly to the workload specification. An underprovisioned workload is fixed by increasing requests and limits to protect reliability, and an overprovisioned workload is fixed by decreasing requests and limits and then adjusting cluster CPU and memory allocation to match. Those Pod decisions flow to node capacity through Cluster Autoscaler, which adds or removes nodes based on unschedulable Pod demand, Horizontal Pod Autoscaler, which changes replica count on CPU, memory, or custom metrics, and Node Auto-Provisioning, which automatically creates optimized node pools for pending workloads.
Tuning in Cloud Run centers on instance and CPU allocation against traffic. Cloud Run offers built-in autoscaling that increases instances as incoming traffic rises and scales instances down as traffic falls, so cost follows demand without infrastructure management. The default CPU allocation method allocates CPU only during request processing, while always-allocated CPUs keep CPU available outside requests to handle predictable traffic loads at a fraction of the price of the default method for that pattern. GKE cost-optimization and cost-allocation metrics provide the detailed breakdown by namespace and workload that links these configuration choices back to spend.
Discounts lower the billing rate after resources are right-sized, and the choice depends on predictability and willingness to commit. Committed use discounts (CUDs) provide significant price reductions in exchange for committing to a minimum quantity or spend for a one-year period or a three-year period, and they suit resources with predictable and steady usage. Sustained use discounts in Compute Engine provide automatic discount credits after continuous resource usage beyond specific duration thresholds in the billing cycle, with no commitment required. Spot VMs provide a separate low-rate option by offering unused VM capacity at more than 80% lower cost than regular VMs, but Compute Engine can preemptively stop or delete them to reclaim capacity, so they fit only fault-tolerant and flexible workloads such as batch jobs without high-availability requirements.
The following table compares the commitment-based and automatic discount options supported by the documentation:
| Option | Commitment | Scope and application |
|---|---|---|
| Resource-based CUDs | Commit to minimum quantity of Compute Engine resources for 1 year or 3 years | Applies to resources in a specific region; for most Cloud Billing accounts, shared across all projects on that account |
| Spend-based CUDs | Commit to minimum spend on a product for 1 year or 3 years | Applies at the billing account level, regionally or globally depending on product |
| Sustained use discounts | No commitment; earned by continuous use beyond threshold | Applies automatically to eligible Compute Engine and GKE usage in the billing cycle |
A central FinOps team can maximize commitment discounts because it sees requirements across the organization and can aggregate them, while product teams manage resource optimization. CUDs can be stacked on top of negotiated enterprise discounts for additional savings, and CUD auto-renewal avoids a coverage gap by repurchasing commitments when they expire. Careful region selection also affects the rate, since resource prices vary by region alongside latency, compliance, and sustainability tradeoffs evaluated with tools such as the Google Cloud Region Picker.
Exam tip: Resource-based CUDs require a 1-year or 3-year quantity commitment in a specific region, while sustained use discounts apply automatically after continuous use with no commitment.
The most cost-effective service is the one where workload shape, state, and management needs align with pricing without paying for idle capacity. Variable request-driven stateless services with bursty or idle-prone traffic fit Cloud Run because it scales instances with traffic and scales to zero by default, multiple containerized services with mixed needs fit Google Kubernetes Engine (GKE) with shared nodes and Pod and node autoscaling, and stateful or specialized VMs needing specific images or machine types fit Compute Engine with managed instance groups (MIGs) that scale VM count within minimum and maximum bounds on CPU thresholds.
Committed use discounts (CUDs) provide significant price reductions in exchange for a one-year or three-year commitment and suit predictable and steady usage, while sustained use discounts apply automatically after continuous Compute Engine and Google Kubernetes Engine (GKE) usage beyond duration thresholds with no commitment required. Spot VMs provide unused Compute Engine capacity at more than 80% lower cost than regular VMs but can be preemptively stopped or deleted to reclaim capacity, so they fit only fault-tolerant and flexible workloads such as batch jobs that tolerate preemption.
A workload is underprovisioned when CPU or memory utilization exceeds 150% for at least 10% of the time over the last 15 days and the recommendation is to scale up for reliability, while a workload is overprovisioned when utilization is below 50% for at least 90% of the time over the last 15 days and the recommendation is to scale down to save cost. GKE does not generate a recommendation for the target metric of Horizontal Pod Autoscaler, does not generate one when Vertical Pod Autoscaler already manages requests automatically, and may wait up to three days for new workloads.
An enterprise runs a suite of steady-state microservices on Google Compute Engine virtual machines (n2-standard-8 machine types with 8 vCPUs and 32 GB memory each) across a single region. The workloads run continuously 24/7 with predictable demand.
Cloud Monitoring telemetry shows that across all instances, actual average CPU utilization remains steady at 25% to 30%, while memory utilization remains consistently high at approximately 24 GB. The infrastructure team wants to eliminate resource over-provisioning and secure the highest possible continuous cost reductions over a 3-year commitment period.
Which combination of actions should the DevOps engineer implement to optimize workload efficiency and ongoing costs?
Last updated