Compute volatility configuration (spot vs. standard)
Cost Optimization and Provisioning Architecture
Google Cloud offers two provisioning models for virtual machines that affect both cost and reliability. Standard VMs provide a fixed, always-available instance that you control; they are the default choice for critical services. Spot VMs draw from excess capacity and offer a 60‑91% discount compared to standard prices, but they can be reclaimed (preempted) by Google at any time, so they carry no Service Level Agreement (SLA). Choosing between them means balancing your budget against the performance needs of your application.
Spot VMs are ideal for fault-tolerant tasks such as batch processing, data analysis, scientific simulations, and CI/CD pipelines—jobs that can pause and resume without loss. To protect progress, use shutdown scripts that save checkpoints to Cloud Storage before the instance stops. For production environments you can combine both models inside a Managed Instance Group (MIG). The MIG automatically recreates spot instances after preemption and maintains a baseline of standard instances, ensuring minimum service while scaling cheaply when possible.
Beyond basic provisioning, Committed Use Discounts (CUDs) lower costs for predictable workloads by committing to one or three years of usage. The Recommender tool analyzes eight days of usage to suggest optimal machine sizes. Combining CUDs, machine‑type recommendations, and a mix of spot and standard instances creates a cost‑efficient architecture that matches spending to actual demand.
Operational Characteristics and Workload Suitability
Standard VMs give you full control over lifecycle: they run until you stop them and support live migration and automatic restart during maintenance. Spot VMs, by contrast, are non‑guaranteed resources that can be preempted when Google needs capacity back. The discount of 60–91% comes at the cost of no SLA, no live migration, and no automatic restart. When a spot VM is preempted, Google follows a termination action (stop or delete) that you define during creation.
Choosing the right model depends on how well the workload handles interruptions. Standard VMs suit mission‑critical applications that need constant uptime, such as web servers, primary databases, or real‑time systems. Spot VMs fit fault‑tolerant, stateless, or batch‑oriented tasks. Common examples include large‑scale data analytics, scientific simulations, rendering jobs, and continuous integration pipelines. Because these jobs can resume from checkpoints, a sudden stop does not cause total failure.
You set the provisioning model at instance creation using the Google Cloud console, the gcloud CLI, or the API. After creation, you can verify the model by checking the scheduling properties. Managing a mix of standard and spot VMs within a single cluster lets you keep progress steady while controlling costs. Use Managed Instance Groups to automatically recreate spot instances after preemption, so the cluster eventually returns to its target size without manual intervention.
Preemption Handling and Resilience Strategies
When a Spot VM is marked for preemption, Google sends a termination signal that gives the instance 30 seconds to complete clean‑up tasks. During this window, a shutdown script can save checkpoints to Cloud Storage, close network connections, and log the current state so the job can resume later. This script is essential for fault‑tolerant workloads like batch processing, where losing progress would be expensive.