Cloud Provider Price Performance Comparison: Spot VMs
Tags: devops, googlecloud, aws, perl
Published: 2023-06-25 21:32:38

Last month, I [published a comparison](https://dev.to/dkechag/cloud-vm-performance-value-comparison-2023-perl-more-1kpp) of the Compute VM performance & price among 10 Cloud providers. While I covered both on-demand and reserved prices, I left Spot VM pricing for a future addendum, which is what this post is about. I'll explore the substantial savings that Spot instances can offer for many scenarios, even though they are not appropriate for all workloads.

[Jump directly to results](#performanceprice-comparison)

## What are Spot / Preemptible VMs?

Several Cloud providers allow customers to use their excess/unused compute capacity at deep discounts. The drawback is that the heavily discounted VMs can be preempted (terminated) at any time when the capacity is needed to cover standard VM usage. This makes Spot VMs a good match for fault-tolerant workloads.

The exact way Spot instances work in regard to pricing, preemption warning, uptime etc varies depending on the provider, so we will take a closer look at the specifics for each.

At [SpareRoom](https://www.spareroom.co.uk/), we use [GCP Spot VMs](https://cloud.google.com/compute/docs/instances/spot) for running our perl test suite, part of our CI pipeline. The machine types we are using would cost $500-$700/month per instance with on-demand prices - we currently get an 80-90% discount over that ($70-$80/month)! We also use Spot instances to launch full test environments for development branches, this allows us to use production-class instance types to evaluate performance, without paying dearly for the privilege.

Any stateless workload where you can handle an instance dying (normally with a prior warning of 30 secs or more) can be a good use-case for a Spot VM, especially applications that require a high level of scalability. You could even work with workloads that would not seemingly be fault tolerant. E.g. if you have web servers behind a load balancer, you will already be handling session/state separate from the VM instance (e.g. we use [Memorystore](https://cloud.google.com/memorystore)), so you can remove a Spot instance that is about to terminate from the load balancer, replacing it with a new one. Depending on the specifics you might want to have a mix of Spot and standard instances and perhaps even to route specific types of requests to the latter, but such a solution would still provide significant savings, or a significant increase in capacity for a specific budget.

Note that in general the discounts apply to compute resources (CPUs, RAM, GPU), but not storage, bandwidth, licenses etc.

## Providers offering Spot VMs

6 out of the 10 providers I tested are providing Spot VM pricing. Spot pricing can vary with time, the listed prices were sampled from June 10th to 20th, for the region I used in the original comparison (usually US East):

### Amazon Elastic Compute Cloud (EC2)

Instance Type|CPU type      |CPU GHz/ RAM/SSD|Price $/Month|Spot $/Month
-------------|--------------|----------------|-------------|------------
c6g.large    |AWS Graviton2 |2.5/4/30        |52.04        |32.68       
c5a.large    |AMD Rome      |3.3/4/30        |58.61        |32.75       
c6i.large    |Intel Ice Lake|2.9/4/30        |64.45        |32.8        
c6a.large    |AMD Milan     |1.95/4/30       |58.24        |33.11       
c7g.large    |AWS Graviton3 |2.6/4/30        |55.18        |33.01       

[Amazon EC2 Spot Instances](https://aws.amazon.com/ec2/spot/) advertise discounts of up to 90%. In reality, the discounts vary significantly per region, type and even instance size and end up being much more modest if you require a specific instance type/size. They can also change quickly (their [pricing tool](https://aws.amazon.com/ec2/spot/pricing/) is updated every 5 minutes) and they allow you to set a maximum price you are willing to pay (with your VM terminated if market price exceeds that). In all, the discounts I obtained for the tested instances were 50% or less.

Even though the discounts were not as spectacular as other providers, Amazon offers a very generous 2 minute preemption warning, which should allow most tasks to gracefully end (and perhaps even time for a replacement instance to spin up). In addition, AWS makes it easy to set up their [Auto Scaling with Spot instances](https://aws.amazon.com/getting-started/hands-on/ec2-auto-scaling-spot-instances/), requiring less work to include Spot instances in your setup.

### Google Compute Engine (GCE)

Instance Type|CPU type        |CPU GHz/ RAM/SSD|Price $/Month|Spot $/Month
-------------|----------------|----------------|-------------|------------
n2d-c2-4096  |AMD Milan       |2.45/4/30       |45.78        |10.68       
t2d-s2       |AMD Milan       |2.45/8/30       |64.68        |12.77       
c2d-hcpu2    |AMD Milan       |3.05/4/30       |57.72        |14.6        
t2a-s2       |Ampere Altra    |3.0/8/30        |59.21        |19.86       
n2-c2-4096   |Intel Cascade L |2.8/4/30        |52.15        |17.18       
n2-c2-4096   |Intel Ice Lake  |2.6/4/30        |52.15        |17.18       
e2-c2-4096   |Intel Broadwell |2.2/4/30        |43.38        |18.12       
n1-c2-4096   |Intel Skylake   |2.0/4/30        |45.99        |18.32       
c2-s4 /2\*   |Intel Ice Lake  |2.7/8/30        |63.99\*      |9.92        
c3-hcpu4 /2\*|Intel Sapphire R|2.7/4/30        |65.91\*      |8.71      

[GCP Spot VMs](https://cloud.google.com/spot-vms) offer some of the most generous discount for compute resources among providers. What's more, the prices are not very different from region to region and are stable enough (can only change up to once per month) for them to be on the [main price list](https://cloud.google.com/compute/all-pricing) - no need for special pricing tools. Also, the discounts are only different per type, regardless of instance size. All this allow you to plan ahead and easily figure out what you are paying.

From the table you can see some amazing savings, with the C3 being a big standout. That's the latest Sapphire Rapids type, so it would seem that Google's customers have not yet started using it en-masse and there is a lot of spare capacity. At full price, we saw that the C3 was not great value, but at a 90% discount this should be a whole different discussion!

The GCP Spot VMs we are using seem to have a lifetime measured often in hours and sometimes in days, depending on the type and region. However, the preemption warning Google offers is 30 seconds, which is less generous than AWS.

### Microsoft Azure

Instance Type|CPU type       |CPU GHz/ RAM/SSD|Price $/Month|Spot $/Month
-------------|---------------|----------------|-------------|------------
D2pls_v5     |Ampere Altra   |3.0/4/32        |52.04        |7.36        
F2s_v2       |Intel Cascade L|2.6/4/32        |64.16        |14.87       
D2ls_v5      |Intel Ice Lake |2.8/4/32        |64.45        |27.22       
D2as_v5      |AMD Milan      |2.45/8/32       |65.18        |8.68        

The [Azure Spot Virtual Machines](https://azure.microsoft.com/en-us/products/virtual-machines/spot/) behave like on AWS, with prices that can vary in time and preemption when market price is above your set maximum. You can use the "[spot advisor](https://azure.microsoft.com/en-gb/pricing/spot-advisor/)" to find the best discounts. However, the actual discounts are much deeper than AWS for most types - I'd say the pattern is similar to GCP. Preemption warning is also like GCP at 30 seconds.

As you'd expect from Microsoft, Windows VMs have similar discounts.

### Oracle Compute VM

Instance Type  |CPU type      |CPU GHz/ RAM/SSD|Price $/Month|Spot $/Month
---------------|--------------|----------------|-------------|------------
Standard.A1 (A)|Ampere Altra  |3.0/4/30        |20.26        |10.77       
Standard3 (I)  |Intel Ice Lake|2.6/4/30        |35.5         |18.39       

The Oracle Cloud Infrastructure's [Preemptible Instances](https://docs.oracle.com/en-us/iaas/Content/Compute/Concepts/preemptible.htm) follow the provider's simpler pricing scheme and they are a fixed 50% discount over their on-demand pricing. The instance preemption notification comes as a 2 minute warning, which is as good as AWS.

The Standard.E2 I tested previously seems to be getting discontinued, so I removed it (no Preemptible price available). But the Standard.A1 which was the revelation of the comparison should still be competitive.

### Alibaba Elastic Compute Service (ECS)

Instance Type |CPU type       |CPU GHz/ RAM/SSD|Price $/Month|Spot $/Month
--------------|---------------|----------------|-------------|------------
ecs.n4.large  |Intel Skylake  |2.5/4/30        |36.5         |7.3         
ecs.c6.large  |Intel Cascade L|2.5/4/30        |57.67        |14.6        
ecs.hfc6.large|Intel Cascade L|3.1/4/30        |65.7         |12.41       
ecs.c7a.large |AMD Milan      |2.55/4/30       |59.13        |13.87       
ecs.c7.large  |Intel Ice Lake |2.7/4/30        |63.51        |18.25       

The ECS [Preemptible Instances](https://www.alibabacloud.com/help/en/elastic-compute-service/latest/preemptible-instances-overview) are a bit similar to Azure in that they offer deep discounts, but they vary with time. There is a bidding process that's similar to AWS/Azure, basically if spot prices go higher than what you are willing to pay, the instance is released.

The Alibaba preemptible instances have a couple of great and unique features:

- You get a very generous 5 minute warning before they are released/terminated.
- You can launch them with a 1 hour minimum uptime guaranteed if you wish. You lose an extra 10% discount in that case (the discount is included in the table above).

That's the good, the bad is that there's no simple pricing tool, you have be logged in to search through the options in the pricing calculator and then when you actually try to order you might find some options missing. e.g. I could price an instance with a lower cost "Ultra Disk", but could only order it with the more expensive Enhanced SSD type.

### Tencent Cloud Virtual Machine (CVM)

Instance Type|CPU type       |CPU GHz/ RAM/SSD|Price $/Month|Spot $/Month
---------------|---------------|----------------|-------------|------------
S5.MEDIUM4   |Intel Cascade L|2.5/4/65        |45.60        |16.8        
C3.MEDIUM4   |Intel Skylake  |3.2/4/65        |59.70        |19.38       
SA2.MEDIUM4  |AMD Rome       |2.6/4/65        |38.40        |15.36       

[Spot Instances](https://www.tencentcloud.com/document/product/213/17816#2.-system-interruption-mechanism) are a new feature of CVM and that shows, as there's still some contradictory info in the FAQ. Overall, you have to log in and start the buying process to see prices, and prices vary with time similar to Alibaba etc. The discounts are usually better than 50% and the preemption notification comes at 2 minutes.


## No Spot VM Providers

I am listing the rest of the providers included in my performance tests that have to "compete" without any Spot VM discounts, only OVH had price changes since last month:

### DigitalOcean Droplets

Instance Type|CPU type       |CPU GHz/ RAM/SSD|Price $/Month
-------------|---------------|----------------|-------------
Basic-2      |Intel          |2.3/4/80        |24.00        
Premium-2    |Intel Cascade L|2.5/4/80        |28.00        
Premium-2-AMD|AMD Rome       |2.0/4/80        |28.00        
CPU-opt-2 (S)|Intel Skylake  |2.7/4/25        |42.00        
CPU-opt-2 (C)|Intel Cascade L|2.7/4/25        |42.00        
CPU-opt-2 (I)|Intel Ice Lake |2.6/4/25        |42.00  

### Akamai (Linode)

Instance Type    |CPU type  |CPU GHz/ RAM/SSD|Price $/Month
-----------------|----------|----------------|-------------
Linode 4GB (N)   |AMD Naples|2.2/4/80        |24.00        
Linode 4GB (R)   |AMD Rome  |2.9/4/80        |24.00        
Linode 4GB (M)   |AMD Milan |2.0/4/80        |24.00        
Dedicated 4GB (N)|AMD Naples|2.0/4/80        |36.00        
Dedicated 4GB (R)|AMD Rome  |2.9/4/80        |36.00        
Dedicated 4GB (M)|AMD Milan |2.0/4/80        |36.00    

### OVHcloud

Instance Type|CPU type     |CPU GHz/ RAM/SSD|Price $/Month
-------------|-------------|----------------|-------------
D2-4         |Intel Haswell|2.0/4/50        |17.3         
S1-8         |Intel Haswell|2.1/8/40        |32.05        
B2-7         |Intel Haswell|2.4/7/50        |59.35        
C2-7         |Intel Haswell|2.7/7/50        |85.85   

The on-demand prices seem to have gone quite a bit higher for all but the D2. It is a bit confusing as OVH has a different site for each region, but I am looking at the [global site price list](https://www.ovhcloud.com/en/public-cloud/prices/) for the table above.

### IBM Cloud Compute

Instance Type|CPU type       |CPU GHz/ RAM/SSD|Price $/Month
-------------|---------------|----------------|-------------
cx2-2x4 (S)  |Intel Skylake  |2.6/4/100       |64.01        
B1.2x4 (B)   |Intel Broadwell|2.1/4/25        |45.25        
cz2-2x4 (Z)  |IBM z15        |4.5/4/100       |142.26       

## Performance/price comparison

I'll use the performance evaluation from my [original comparison](https://dev.to/dkechag/cloud-vm-performance-value-comparison-2023-perl-more-1kpp), so look there for details on testing and caveats.

### Single-thread Performance/Price (Perl)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uqke4jzpuaf55n153tre.png)

**Google** and **Azure**'s Spot VMs provide some tremendous value. You get up to **FOUR TIMES** the performance for price compared to anything **AWS** (or even **Linode**/**DigitalOcean**) have to offer. I mentioned the **GCP** **c3** instances above - use them now for your Spot instances while they're so cheap! Remember they are available only for 4 vCPU minimum, if you want 2 vCPU you'd have to go to **n2d** (and **t2d** for 1 vCPU). If you're on the **Azure** cloud, the **Milan** or **Altra** instances are almost as good.

**Alibaba**'s compute also offers great value, coming just behind the two leading providers, along with **Oracle** - which is still a good value with their **Standard.A1**. **Tencent** beats **AWS**, but lags behind the 4 leading providers.

### Multi-thread Performance/Price (Perl)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bk11bamum2qg0zjrwl5z.png)

The non-[SMT](https://en.wikipedia.org/wiki/Simultaneous_multithreading) (**ARM**, **GCP** **t2d**) and shared CPU types get a boost in the multi-thread comparison, so **Azure**'s Ampere **Altra** type leads with **Alibaba**'s shared **n4**, **GCP**'s **c3**, **c2** and **t2d** and **Azur**e's **Milan** following closely.

The **Oracle Standard.A1** is closer to the top, while the rest of the field is not very different than the single-thread comparison.

### Geekbench 5 Performance/Price

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hfuo0me79ng4av7j0cqr.png)

Geekbench 5 pretty much confirms what we saw with the Perl benchmark suite - **Azure**'s **Altra** and **Milan** instances along with **GCP**'s **Sapphire Rapids** and **Milan** offer the best value for dedicated CPU instances (the **Alibaba** **n4** shared is up there with them), with **Oracle**'s **Altra** following closely.
**AWS** only competes well with the providers that are not offering Spot VMs.

## Conclusion

Overall, Spot instances can provide some amazing savings. If you can take advantage of Spot instances, I would rate the cloud providers in this order with value in mind:

- **Google Cloud:** They have the clearest and stables pricing structure, along with some of the deepest discounts. I gave the example of our own testing pipeline - the **c3-highcpu-22** instances we are currently using would set us back $692/instance-month (excluding storage), and we are getting them for just $63! If these new instances become more popular with customers and their Spot pricing increases, **t2d**, **c2**, **n2d** instances are all offering near top performance/price. The only disadvantage is the 30 second preemption notification.

- **Microsoft Azure:** Similar discounts and 30 second notification as **GCP**, but with a more complex and less fixed pricing structure. Their **ARM** offering is the top multi-threaded performance/price and of course they are the obvious choice for **Windows**.

- **Oracle Cloud Infrastructure:** If you are looking for a mixed standard + Spot cloud and can use **ARM** VMs, the **Standard.A1** will probably offer the best value, depending on the standard vs Spot instance ratio, as it was by far the best on-demand instance in the original comparison.

- **Alibaba ECS:** Some great discounts, best one on the shared CPU n4 type, but of course a few caveats, including limited regions/availability in the US/Europe, complicated spot pricing etc.

While I found **Amazon**'s Spot pricing quite disappointing in comparison to **Azure**/**GCP**, it does offer significant savings. Significant enough to compete in price with budget providers like **Akamai/Linode** or **DigitalOcean** (while trouncing most **OVH** solutions), and perhaps even easier to take advantage of given the longer notification time and integration with their own Auto Scaler. I wouldn't move to **AWS** just for their Spot instances, but I'd definitely take advantage of them if I were using the provider, either as my main cloud, or as part of a hybrid solution.