Prepare and test your skills
Prepare and test your skills
Specialized hardware and compliance-driven compute selection is the practice of matching Compute Engine (opens in a new tab) resources to performance, isolation, and licensing needs instead of using a default virtual machine (VM). Compute Engine is an infrastructure as a service (IaaS) product that provides self-managed VMs with a KVM hypervisor for Linux and Windows. You configure and control Compute Engine resources by using the Google Cloud console, the Google Cloud CLI, or a REST-based API. Selection balances cost, performance, and workload rules by choosing the machine family, accelerators, CPU threading, region, and license model.
The decision follows workload needs first and platform capabilities second. First, the workload's parallelism, latency, state, and regulatory limits determine what is required. Then, the architect maps those needs to accelerator-optimized machines, custom sizing, thread settings, and placement. This order matters because specialized performance and compliance limits narrow the valid machine types and regions before cost tuning begins. Specialized options also include TPUs for deep learning and sole-tenant nodes for strict security, isolation, and licensing compliance.
Accelerator-optimized machines are the Compute Engine family for workloads that need hardware accelerators in addition to CPUs, such as GPUs for parallel processing. Compute Engine provides a comprehensive set of machine families, and each family contains machine series and predefined machine types. The families cover different bottlenecks:
An accelerator-optimized VM depends on the accelerator attached to the instance, and the application depends on that combined CPU-plus-accelerator capacity to complete parallel work. Choose an accelerator-optimized machine type when the bottleneck is parallel throughput or accelerated computation that general-purpose CPUs alone cannot meet efficiently. Choose one of the other families when the bottleneck is general CPU, memory, storage, or networking without a need for accelerators.
Custom sizing and thread tuning are Compute Engine (opens in a new tab) controls for fitting vCPUs and memory to exact workload and software-license needs. A custom machine type provides customized CPU and memory resources for some machine series when a preconfigured, general-purpose machine type does not meet your needs. Each virtual CPU (vCPU) is implemented as a single hardware multithad, and by default two vCPUs share one physical CPU core.
Thread tuning changes how those vCPUs map to physical cores. For applications with highly parallel operations or floating-point calculations, such as genetic sequence analysis and financial risk modeling, you can improve performance by reducing the number of threads that run on each physical CPU core. The same setting has a compliance effect because VM multithreading might have licensing implications for some third-party software, like databases. Specify the exact software version in startup scripts and templates as well, so recreated VMs install consistent software and remain license-compliant.
Exam tip: Reduce threads per core to help highly parallel or floating-point workloads, but check third-party database licensing first because threading changes can affect license terms.
Compliance-driven placement and license decisions are choices about where Compute Engine VMs run and who carries the software-license cost to meet regulatory, security, and contractual rules. Region choice is constrained by several peer factors that often trade off against each other:
The most cost-efficient region might not have the lowest carbon footprint or the required machine types, so the compliant region and machine type must be selected first. Data placement follows the same boundary logic: zonal volumes stay in one zone, regional volumes replicate synchronously across two zones in a region, and data is not replicated across regions unless a multi-region storage service is used.
License ownership depends on whether the database runs self-managed on Compute Engine or managed in Cloud SQL. When you run a database like Microsoft SQL Server on Compute Engine VMs, you must consider the license costs for the third-party software in addition to VM cost. When you use a managed database service like Cloud SQL, the database license costs are included in the charges for the service.
| Option | Operating system control | License handling |
|---|---|---|
| Cloud SQL for SQL Server | Limited, Google manages the platform | License costs are included in service charges |
| Compute Engine VMs with SQL Server | Full, you retain access to the operating system | You must consider and carry third-party license costs |
Choose Cloud SQL for SQL Server when the managed configuration meets your needs and you want simplified licensing. Choose Compute Engine VMs, including a failover cluster instance when needed, only when Cloud SQL does not support your configuration requirements or when you need access to the operating system.
Cost optimization through Spot VMs is the use of excess Compute Engine capacity at much lower prices for workloads that can tolerate interruption. Spot VMs (opens in a new tab) are the latest version of preemptible VMs sold through the spot provisioning model. Discounts reach up to 91% for many machine types, GPUs, TPUs, and Local SSDs, but Compute Engine can reclaim the capacity at any time by preempting the VMs. Spot VMs trade guaranteed availability for major cost savings.
Suitability for Spot VMs means the workload can fail gracefully without losing critical work or requiring guaranteed capacity. Spot VMs provide the same machine types, options, and performance as regular VMs while they are running, with no minimum or maximum runtime unless a runtime limit is configured. A batch-processing job running across many Spot VMs illustrates the fit: if some VMs are preempted, the overall job slows but does not completely stop, and the extra capacity completes work without loading existing VMs or paying full on-demand price.
Spot VMs are therefore suitable for fault-tolerant, stateless workloads that can fail gracefully, including batch jobs and fault-tolerant application and web tiers that do not have high availability requirements. They are not suitable for stateful services, critical request paths, or any workload that requires guaranteed capacity or an uptime commitment. Choose Spot VMs when interruption only delays completion; choose standard capacity when interruption would break correctness or availability.
Preemption of Spot VMs is the process where Compute Engine reclaims excess capacity by stopping or deleting Spot VMs at an uncertain time. Preemption can happen when resources are needed for other tasks or system events. The probability of preemption is generally low but varies from day to day and from zone to zone, and Spot VMs are finite resources that might not always be available in a requested zone. The configured termination action controls what happens during preemption: Compute Engine either stops the VM, which is the default, or deletes the VM entirely.
Spot VMs function like standard VMs but carry strict operational limits:
Because availability varies, best practices include viewing Spot VM availability before creation and, for managed workloads such as Cloud Batch (opens in a new tab), combining Spot VMs with instance flexibility across multiple machine types and automatic retries that recreate VMs after preemption.
Exam tip: Stop is the default termination action for Spot VMs during preemption; delete must be explicitly selected, and neither option preserves guaranteed availability or SLA coverage.
The financial trade-off of Spot VMs is lower compute cost in exchange for non-guaranteed availability and reduced operational control. Savings are largest for large, parallel, or retryable work where interruption only delays completion, while the cost of interruption is highest for workloads that need capacity assurance, live migration, automatic restart, or autoscaling to a precise size on demand. Stateless MIGs can use autoscaling to add Spot capacity when traffic rises and reduce cost when demand falls, but stateful MIGs cannot be autoscaled, which further limits the use of Spot VMs for stateful designs. Choose Spot VMs when the workload can absorb preemption and capacity delays; choose guaranteed capacity when the workload cannot.
A comparison matrix table contrasting four Compute Engine obtainability modes — On-demand VMs, Spot VMs, Reservations, and Dynamic Workload Scheduler — by their cost and availability characteristics and the workloads each is best suited for.
Spot VMs are one of four obtainability modes for Compute Engine, Google Kubernetes Engine (GKE), Cloud Batch, and AI training and inference services:
| Mode | Cost and availability | Choose when |
|---|---|---|
| On-demand VMs | Standard price, subject to zonal stock-outs | The workload needs standard VMs without a reservation or queue |
| Spot VMs | Much lower price, no capacity assurance, can be stopped or deleted at any time | The workload is fault-tolerant, stateless, and batch-oriented |
| Reservations | Reserved capacity held as a pool of VMs, with cost and availability implications | The workload needs capacity assurance and higher scheduling goodput |
| Dynamic Workload Scheduler | Queued requests for GPU-powered VMs in a dedicated pool | The workload needs GPUs while avoiding on-demand stock-outs, Spot preemption risk, and reservation overhead |
Reservations maximize scheduling goodput by ensuring resources are available when required, while Dynamic Workload Scheduler avoids the statelessness constraint and preemption risk of Spot VMs and the stock-out risk of on-demand VMs.
Resource tailoring with custom machine types is the practice of choosing an exact combination of virtual CPUs and memory for a VM so the VM matches what an application actually needs. In Google Compute Engine (opens in a new tab), a custom machine type lets an architect move beyond a fixed predefined size and provision only the CPU and memory required for predictable workloads. This alignment reduces waste from idle resources while still meeting performance demands.
Custom machine types in Compute Engine are user-defined sizes available for some machine series when a predefined general-purpose size does not fit. Compute Engine organizes machine types into families, series, and predefined sizes that target different bottlenecks:
A custom machine type depends on the selected series and zone, and the VM is billed only for the CPU and memory that are provisioned, with no up-front cost. The custom size therefore connects the workload demand directly to the billed resources, unlike a predefined size that may include unused capacity.
Matching CPU and memory to application demands means selecting a machine type based on observed or predictable use rather than choosing the closest large predefined size. Machine type recommendations in Compute Engine analyze VM utilization and suggest a machine type that matches the workload's compute requirements. For workloads with stable and predictable CPU and memory needs, a custom machine type uses that recommendation to rightsize the VM and avoid paying for unused capacity.
| Option | What is provisioned | Choose when |
|---|---|---|
| Predefined machine type | Fixed CPU and memory set by Compute Engine | Needs are standard or still changing and simplicity matters more |
| Custom machine type | Custom CPU and memory chosen for the workload | Needs are predictable and a predefined size would leave CPU or memory idle |
Choose a custom machine type when monitoring shows consistent waste — for example, memory is fully used while half the CPUs sit idle, or the reverse. The custom VM then carries the application load with less overhead because resource provisioning follows application demand.
Reducing cost and licensing overhead with custom machine types means provisioning CPU cores independently of memory to control both infrastructure and software costs. Some third-party software is licensed per CPU core, so extra cores that are not needed directly increase license cost. A custom machine type with extended memory allows an architect to add memory without adding cores, which limits licensing cost to only the number of CPU cores that are needed.
The same tailoring applies to multithreading. Each virtual CPU is implemented as a single hardware multithread, and by default two virtual CPUs share one physical core. For bring-your-own-license (BYOL) workloads such as Microsoft Windows Server or Microsoft SQL Server on Compute Engine VMs, disabling simultaneous multithreading (SMT) reduces the number of virtual CPUs per core from 2 to 1. The VM then depends on fewer licensable virtual CPUs while keeping the required memory, so infrastructure spend and license spend move together.
Exam tip: Use a custom machine type for predictable workloads where a predefined size wastes CPU or memory; use machine type recommendations first to identify the right CPU and memory combination.
Use Spot VMs in Compute Engine for fault-tolerant, stateless workloads such as batch jobs that can fail gracefully where interruption only delays completion, and use standard capacity when interruption would break correctness or availability. Spot VMs offer discounts of up to 91% for many machine types, GPUs, TPUs, and Local SSDs while providing the same machine types and performance while running, but they can be reclaimed at any time and carry no Service Level Agreement coverage.
Cloud SQL for SQL Server includes database license costs in the service charges with limited operating system control because Google manages the platform, while Compute Engine virtual machines with SQL Server give you full operating system control but require you to consider and carry third-party license costs separately. Choose Cloud SQL for SQL Server when the managed configuration meets your needs and you want simplified licensing, and choose Compute Engine VMs only when Cloud SQL does not support your configuration requirements or you need access to the operating system.
Use a custom machine type in Compute Engine when workload CPU and memory needs are stable and predictable and a predefined size would leave CPU or memory idle. A custom machine type provisions only the CPU and memory the workload needs and bills only for those resources with no up-front cost, including extended memory options that add memory without adding cores to limit per-core licensing cost.
A financial analytics company runs large-scale, fault-tolerant nightly batch processing workloads on Google Compute Engine. The processing application can gracefully checkpoint progress, handle node terminations, and run on various CPU architectures and sizes.
Management requires a compute architecture that minimizes infrastructure costs using Spot VMs while mitigating the risk of batch processing delays caused by high localized preemption rates or capacity shortages for a single machine type.
Which configuration should the cloud architect recommend?
Configure a single-zone Managed Instance Group (MIG) with a static instance template using Spot VMs and disable VM repairs to avoid reprovisioning costs.
Configure a Dataproc cluster and set all primary master and worker nodes to use Spot VMs without secondary workers.
Configure a regional Managed Instance Group (MIG) using Spot VMs configured with an instance flexibility policy specifying multiple compatible machine types.
Configure a regional Managed Instance Group (MIG) using standard on-demand VMs with 1-year committed use discounts (CUDs) restricted to a single machine family.
Last updated