Google Cloud Platform offers a range of machine types optimized to meet various needs. Machine types provide virtual hardware resources available to a virtual machine that vary by virtual CPU (vCPU), disk capability, and memory size, giving you a breadth of options. Within every machine family there’s a set of machine types that offer a combination of memory and processor configuration. With so much to choose from, finding the right Google Cloud machine type for your workload can get complicated.
Since we’ve gone over EC2 instance types and Azure VMs, we’re doing an overview of each GCP machine type. The image below shows the basics of what we will cover, but remember that you’ll want to investigate further to find the right machine type for your particular needs.
A version of this article was published in 2018. It has been completely revised and updated for 2021.
General-Purpose Machine Type Family
General-purpose machine types are resources managed by Google Compute Engine. Each machine type in the general-purpose machine type family is curated for specific workload types. You’ll find that these machine types are suitable for a variety of common workloads. Some examples of these workloads include: development and testing environments, databases, mobile gaming and web applications. These machines are known for offering the best balance of performance and price. Within the General-purpose family, you can choose from four general-purpose machine types: E2, N2, N2D, and N1.
E2 Machine Types
E2 VMs provide a variety of compute resources for the lowest on-demand pricing across all general-purpose machine types. E2 machine types also utilize dynamic resource management, which offers numerous benefits for workloads that prioritize cost savings. These machine types offer the lowest cost of ownership on Google Cloud – you’ll see up to 31% of savings compared to N1. Additionally, pricing for E2 VMs already includes sustained use discounts and are also eligible for committed use discounts – which increases potential savings of up to 55%.
Best fit: Workloads such as small-to-medium databases, web serving, and application development and testing environments that don’t require large instance sizes, GPUs or local SSD would all be good fits for E2.
N2 Machine Types
N2 machine types are the second generation general-purpose machine types that support up to 80 vCPUs and 640 GB of memory. N2 VMs offer you the ability to get about 30% higher performance from your VMs, and shorten many of your computing processes. These machine types offer higher memory-to-core ratios for VMs created with the extended memory feature.
Best fit: General purpose workloads including web and application servers, enterprise applications, gaming servers, content and collaboration systems, and most databases.
N2D Machine Types
N2D machine types are the largest general-purpose machine type with up to 224 vCPUs and 896 GB of memory. These VMs are designed to provide you with the same features as N2 VMs.
Best fit: Web applications, databases, workloads, and video streaming.
N1 Machine Types
N1 VMs are first-generation general-purpose machine types that support up to 96 vCPUs and 624GB of memory. Though most would recommend using one of the second-generation general-purpose machine types, N1 VMs do offer a larger sustained use discount than N2 machine types. Additionally, they have support for Tensor Processing Units (TPUs) in select areas.
Compute-Optimized Machine Type Family
Compute-optimized machine types are ideal for compute-intensive workloads. These machine types offer the highest performance per core and most consistent performance on Compute Engine. Compute-optimized machine types are suitable for workloads such as game servers, latency-sensitive API serving and high-performance computing (HPC). These machines have 40% greater performance than previous generation N1.
C2 Machine Types
C2 machine types provide full transparency into the architecture of the underlying server platforms which will allow you to fine-tune the performance. C2 machine types run on a newer platform, offer more computing power, and are typically more powerful for compute-intensive workloads compared to the N1 high-CPU machines.
C2 VMs also offer up to 20% sustained use discounts. Additionally, they are eligible for committed use discounts, which would bring potential savings up to 60%.
Memory-Optimized Machine Type Family
Memory-optimized machine types are fit for tasks that require intensive use of memory with higher memory-to-vCPU ratios due to the fact that they offer the highest memory configurations across our VM families with up to 12 TB for a single instance. It is important to note that these machine types do not support GPUs. Memory-optimized machine types offer up to 30% sustained use discounts. Additionally, they are eligible for committed use discounts, bringing additional savings up to greater than 60%.
These machine types are best fit for in-memory databases and in-memory analytics.
M2 Machine Types
M2 VMs support the most demanding and business critical database applications with up to 12TB of memory. These machine types offer the lowest cost per GB of memory on Compute Engine, which makes them a perfect choice for workloads that utilize higher memory configurations and have low compute resources requirements.
M1 Machine Types
M1 machine types are the first generation memory-optimized machine types that offer 4TB of memory. Similar to M2 machine types, M1 machine types offer the lowest cost per GB of memory on Compute Engine.
Accelerator-optimized Machine Type Family
Accelerator-optimized VMs were added in July 2020. This machine type family is optimized for demanding compute workloads – this would be workloads such as high-performance computing and CUDA-enabled machine learning.
A2 Machine Types
Every A2 VM has a set amount of A100 GPUs that offer 20x improvements in computing speed in comparison to previous generation NVIDIA V100 GPUs. These machine types are currently available through Google’s alpha program.
Shared-Core Machine Types
Share-core machine types are a cost-effective option that works well with small or batch workloads that only need to run for a short time. They use partial vCPUs that run on one hyper-thread of the host CPU running your instance. These machine types use context-switching to share a physical core between vCPUs so they can multitask.
The GCP shared-core family provides bursts of physical CPU for brief periods of time in moments of need. They’re like spikes in compute power that can only happen in the event that your workload requires more CPU than you had allocated. These bursts are only possible periodically and are not permanent.
Custom Machine Types
Predefined machine types vary to meet needs based on high memory, high vCPU, a balance of both, or both high memory and high vCPU. If none of the machine types meet your needs, Google has one more option for you – custom machine types. With custom machine types, you can define exactly how many vCPUs you need and what amount of system memory for the instance. They allow you to independently configure CPU and memory to find the right balance for your applications, so you’re only paying for what you need. They’re a great fit if your workloads don’t quite match up with any of the available predefined types, or if you need more compute power or more memory, but don’t want to get bogged down by upgrades you don’t need that come with predefined types.
About GPUs and machine types
On top of your GCP instance types, Google also offers graphics processing units (GPUs) that can be used to boost workloads for processes like machine learning and data processing. You can only attach GPUs to predefined or custom machine types. In general, the higher number of GPUs attached to your instances, the higher number of vCPUs and system memory available to you.
What Google Cloud Machine Type should you use?
Between the predefined options and the ability to create custom Google Cloud machine types, Google offers enough variety for almost any application. Cost matters, but with the resource-based pricing structure, the actual machine you chose matters less when it comes to pricing.
With good insight into your workload and usage trends you have the resources available to find the machine type that fits your business needs.