What is Compute Engine?
At its heart — it’s Infrastructure as a Service. It’s physical servers that you’re used to running inside the Google environment with a number of different configurations. Both predefined and custom machine types allow you to choose how much memory and how much CPU you want. You choose the type of disk you want, whether you want to just use standard hard drives, SSDs, local SSDs or a mix. You can even configure the networking and run a combination of Linux or Windows machines.
Compute Engine provides a number of different machine types. Specifically, there are predefined high CPU, high memory, standard, and shared-core machine types. If those machine types don’t fit your need, you can also customize your own machine. Your choice of CPU will affect your network throughput. Specifically, your network will scale at two gigabits per second for each CPU core up to a maximum of 16 gigabytes per second worth of throughput which is going to be achieved if you have eight virtual CPUs. When you’re migrating from an on-premises world, you use two physical cores have hyper-threading(technology used by some Intel microprocessors that allow a single microprocessor to act like two separate processors to the OS and the application programs that use it). In GCP, its called — vCPUs or virtual CPUs. A vCPU is equivalent to one hyper-thread core. Therefore, if you have a single-core hyper-threaded CPU on-premises, that would essentially be two virtual CPUs to one physical core.
Once you pick you compute options, you want to choose your disk. You have three options — standard SSD, or local SSD. Both of these options provide the same amount of capacity in terms of disk size. Therefore, the question really is about performance versus cost as there’s a different pricing structure model. Basically, SSDs are designed to give you a high number of IOPS per dollar versus standard which will give you a high amount of capacity for your dollar.
Local SSDs have even higher throughput and lower latency than SSD persistent disks because they’re attached to the physical hardware. However, the data that you store on a local SSD persists only until you stop or delete the instance. Typically, a local SSD is used as a swap disk just like you would if you wanted to create a RAM disk. But if you need more capacity, you can store those on a local SSD. You can create instances with up to eight separate 375 gigabyte local SSD partitions for a total of three terabytes of local SSD space for each instance. Standard and non-local SSDs can be sized up to 64 terabytes for each instance. The performance of these disks scales with each gigabyte of space allocated.
Pricing and Discounts
When it comes to virtual machines, GCP offers a variety of different options in order to keep the prices low.
- Virtual machines are built per second, with a one-minute minimum.
- Google offers sustained use discounts, which are automatic discounts that you get for running a VM instance for a significant portion of the billing month. Specifically, when you run an instance for more than 25% of a month, Compute Engine automatically gives you a discount for every incremental second you use for that instance The discount increases with usage. These discounts are applied automatically, there’s no action required on your part to enable these discounts.
- Compute Engine also offers preemptible instances, which come with up to an 80% discount. However, Compute Engine might terminate or preempt these instances with a 30-second notification, if it requires access to those resources for other tasks. Compute Engine actually always terminates preemptible instances after they run for 24 hours.
- GCP offers deeper discounts for VM usage when you purchase committed use contracts, known as — committed use discounts. If your workload is stable and predictable, you can buy a particular amount of vCPUs, memory, GPUs, and local SSDs for a discount off of normal prices in return for committing to a usage term of 1 year or 3 years. The discount is up to 57% for most resources types like machine types or GPUs. The discount is up to 70% for memory-optimized machine types.
- Another neat discount is what Google refers to as — Inferred instance discounts. If you have multiple VMs of the same machine type in the same zone, they are combined as if they were a single machine, giving you the maximum available discount. The instances are combined to find the smallest number of simultaneously running instances, which are called — inferred instances. In the below case, Compute Engine combines the instances to make four inferred instances with the longest possible duration, as we can see on the right. Compute Engine then calculates sustained use discounts based on the percentage of time that each of these inferred instances was running in a month.
Compute Engine also has free usage limits, provides free usage of one f1-micro instance per month, with up to 30 gigabytes of HDD persistent disk. And up to one gigabyte of network egress.
So, that’s all about Compute Engine, next is VM lifecycle.