Move Fast and Break the Cloud
A Benchmark of VM Boot Times on the Google Cloud
For an overview of Google Cloud vs. AWS in terms of pricing and features, see my previous article, A Tale of Two Clouds.
A good rule of thumb on The Cloud™ is that VMs typically boot in 1 to 2 minutes. In this article, we’ll test this hypothesis on the Google Cloud by launching ~5,000 VMs and timing how long it takes for each one to boot.
To that end, the metric we’ll use is time-to-SSH, i.e. the number of seconds from the time we request a new VM to the time we can SSH into it. The scripts used to perform these automated tests are shared towards the end of the article.
We’ll start by measuring the boot time of a relatively small VM, and keep track of how boot time fluctuates over time.
Using a VM with 8 CPUs and 30 GB of RAM (with a 20 GB disk and Debian 9 as the boot OS), I measured time-to-SSH once every 10 minutes, over the course of a few days. Although there were some fluctuation, booting a VM is surprisingly fast: it consistently takes only ~23 seconds for an 8-CPU VM to boot, regardless of the time of day:
The Bigger Picture
At this point, you’re probably wondering how a VM’s boot time would scale with increasing amounts of CPU and RAM. Well, you’re in luck, because the next benchmark measures just that, using the following VM configurations:
| Machine Type | CPUs | RAM |
| n1-standard-1 | 1 | ~4 GB |
| n1-standard-8 | 8 | 30 GB |
| n1-standard-32 | 32 | 120 GB |
| n1-standard-64 | 64 | 240 GB |
| n1-standard-96 | 96 | 360 GB |
For each of the machine types above, I launched a VM of that type every 10 minutes, for a week. Interestingly, the increase in boot time is not linear with VM size! Instead, it consistently averages ~25 seconds for VMs with ≤32 CPUs, and under a minute for VMs with ≤96 CPUs:
It’s interesting that VM boot times stop being constant past 32 CPUs. I’d love to hear from someone at Google Cloud about why that might be.
Don’t Take My Word for It
If you’d like to run the benchmarks above in your own environment, using different VM size/zone/image/etc, the code to automatically launch thousands of benchmarks on GCP is available on GitHub. Simply clone the repo on a small VM in GCP, define benchmark settings in
config.json, and launch
Depending on the VM sizes you’re launching and how many you launch at once, you may need to request a CPU quota increase. Also, if you’re launching benchmarks with thousands of VMs, make sure to keep an eye on the billing! That said, VMs created by the benchmark are programmed to self-destruct after 2 seconds, which avoids runaway VMs.
We’ve already seen that VM size plays a big factor in boot time. The other important factor is the contents of your boot image. Here I used a standard Debian 9 image, but if you’re using large, custom boot images, you may see a slowdown.
Overall, launching virtual machines on the Google Cloud is very fast. The ability to launch 96-CPU VMs in under a minute is certainly great news for load balancing — fast boot times means you can react and auto-scale more rapidly in response to changing traffic patterns. Moreover, fast boot times and per-second usage billing support a model where launching VMs on the fly for time-consuming analyses (more than say 10 minutes) is more cost effective than keeping large VMs waiting around for the next job to process.