Google Cloud offers a variety of compute options to choose from. Ultimately, it depends on what kind of workload you will run and what type of control over the resources you or your team require.
The following figure provides an overview of the Google Cloud compute options. The more we move to the right, the more highly managed and less customizable services are. Services on the left-hand side of the figure are highly customizable and less managed by Google Cloud:
Figure 3.1 – Compute resource options
One thing to remember – you can mix different types of computing resources according to your needs.
We will now describe all Google Cloud compute options:
- Google Compute Engine (GCE): VMs are a commodity, and GCE allows you to choose from various predefined T-shirt sizes and create desired VM sizes according to your requirement. You can select different disk options, attach GPUs, and decide which operating system you want to use.
- Preemptible and spot VMs: Both preemptible and spot VM instances are highly discounted (from 60% up to 91% compared to regular VMs). The difference between preemptible and spot VMs is their lifetime. Preemptible VMs live for up to 24 hours (preemptible) and spot VMs don’t have a maximum runtime. Google Cloud offers them to all customers, and they have one characteristic in common – they can be terminated with a notification sent 30 seconds prior to the termination. Preemptible instances use excess GCE capacity, so their availability varies across Google Cloud regions. The ideal workload for this type of VM is stateless applications, containerized workloads, web apps, or test and development workloads.
- Custom VM sizes: One of the features in GCE we like a lot is the possibility to create custom VM sizes. Google Cloud offers the opportunity to configure VMs according to your needs. Whether you need a powerful VM with many CPUs and you don’t need a lot of RAM, or you want to choose between 1 or 2 vCPUs per core to select a different CPU family type – you are covered.
In the following figure, we can see the process of custom VM creation:
Figure 3.2 – Custom VM size in GCE
Let’s move on to the next set of compute options in Google Cloud:
- Google Kubernetes Engine (GKE): Google Cloud offers managed Kubernetes, which is the best choice for containerized applications that require orchestration, managed scaling, updates, and connectivity. GKE creates Kubernetes master nodes and manages them for end users, as well as allowing node pool creation. Also, autoscaling nodes allow you to monitor resources.
- Cloud Run: Cloud Run is a fully managed serverless platform to run containers. In comparison to GKE, you provide your application’s code, and Cloud Run hosts the application and autoscales it according to the workload.
- Google App Engine: Google App Engine is a fully managed serverless platform for web applications. App Engine is responsible for the application and database autoscaling and providing networking connectivity. It allows you to update applications on the fly, host different versions, and enable diagnostics.
- Cloud Functions: For those who require event-driven serverless functions, Cloud Functions is the best choice. You write code and decide what will happen when the event is triggered, and the rest is done automatically.
- Firebase: If you’re building an application that relies on a backend for synchronization and/or storage, Firebase is a great option. It allows you to store complex NoSQL documents and files using an API and client available for iOS, Android, and JavaScript.
We covered planning all the computing options in Google Cloud. We will now focus on planning database resources and choosing the right database for your workload.