Fundamentals of Google Compute Engine – Part 1

Reading Time: 6 minutes

Have you ever wondered where applications are deployed in the cloud? In the cloud, applications run on virtual servers, just as they do on physical servers in a company’s data center.

In this blog, we will discuss how Google Compute Engine, one of the top products available at Google Cloud Platform, helps us to provision and manage virtual machines.

Before taking a deep dive into Compute Engine, let us get familiar with some of the associated terminologies. This will help us understand it better.

Virtual Machine – A virtual machine (VM) is a digital version of a physical computer. It is a virtual instance of a computer that performs most of the functions of a computer. Virtual machines run on a physical machine and access computing resources from the software which is known as a hypervisor. Virtual machine software can run programs and operating systems, store data, connect to networks and do other computing functions.

Regions – Regions are independent geographic areas that consist of zones. They are collections of zones. You can choose regions that makes sense for your scenario. For example, if you only have customers in the US, or if you have specific needs that require your data to live in the US, it makes sense to store your resources in zones in the us-central1 region or zones in the us-east1 region.

Zones – A zone is a deployment area for Google Cloud resources within a region. The fully-qualified name for a zone is made up of <region>-<zone>. For instance, the fully qualified name for zone ‘a’ in region ‘us-central1’ is ‘us-central1-a’.

Google Compute Engine

What is Google Compute Engine?

Simply put, it refers to customizable virtual machines running in Google Cloud. It allows customers to create and manage lifecycle of virtual machine instances. Compute Engine is Google’s Infrastructure-as-a-Service offering.

Now, let’s look at the features of the Compute Engine.

Google Compute Engine Features –

Google Compute Engine has many features. Here are some of them in detail.

1. Machine Types –

You can select the right machine for your needs from predefined or custom machine types.

Machine Type

Predefined machines come with general-purpose combinations of CPU and memory. Alternatively, you can choose custom machines if predefined machines doesn’t meet your needs. The custom machine types allow the selection of exact number of CPU. Further, you can choose the amount of memory you need based on your workload.

There are three different machine-type families — general purpose, compute optimized, and memory optimized.

Types of Machine Family

1.1. General-purpose – General purpose machines are best suited for general workloads, like web servers and databases. If you’re not sure which family you should choose, just choose general purpose instances.

General Purpose Machine Type

1.2. Compute-optimized – It is recommended to use compute optimized machines for compute-intensive applications, such as high-performance computing, gaming, electronic design automation, and single-threaded apps.

Compute Optimized Machine Type

1.3. Memory Optimized – For memory-intensive workloads, such as in-memory databases, SAP HANA, or real-time analytics, we can use memory-optimized instances. You can add graphical processing units to accelerate computationally-intensive workloads, like machine learning or medical analysis.

Memory Optimized Machine Type

2. Images –

An image contains the OS and the root file system that users leverage to run VM instances. Google Cloud Platform provides two main types of images.

2.1. Type of Images –

2.1.1. Public Images – Public Images are provided & maintained by Google or open-source communities or third-party vendors. By default, all Google Cloud projects have access to these images and can use them to create instances.

2.1.1. Custom Images – A custom image is a boot disk image that you own and control access to. These are created by you for your projects.

3.Storage –

The Compute Engine provides several storage options for VM instances such as persistent disks, Filestore, Local SSD, and cloud storage.

3.1 Persistent Disks – These are durable, high-performance block storage for VM instances which can be created in HDD or SSD formats. Users can take snapshots and create new persistent disks from that snapshot. If a VM instance is terminated, the data is retained by the persistent disk which can be attached to another instance. There are two types of persistent disks:

  • Shared
  • SSD

3.2. File Store – A managed file storage service from Google, Filestore provides high-performance storage for applications requiring a file system interface and a shared file system for data. It facilitates users in setting up their managed Network Attached Storage (NAS) systems with their Google Compute Engine and Kubernetes Engine instances, leading to predictably faster performance for file-based workloads.

3.3. Local SSD – With Google Compute Engine, you can use locally attached SSD block storage that is always encrypted whenever it is used. It improves performance and reduces latency.

3.4. Cloud Storage – Cloud storage is redundant storage that you can mount onto a VMs’ file system, just like persistent disks. It provides some very interesting out-of-the-box features such as object versioning or fine-grain permissions (per object or bucket), that can make development easy and help reduce operational overheads. Google Cloud Storage serves as the foundation of several different services.

4. Load Balancing –

Cloud Load Balancing helps in distributing incoming requests across pools of instances across multiple regions so that users can achieve maximum performance, throughput, and availability at a low cost. It is a fully distributed, software-defined managed service. It isn’t hardware-based, so you don’t need to manage a physical load balancing infrastructure.

Google Cloud offers the following load balancing features:

  • Single anycast IP address.
  • Software-defined load balancing.
  • Seamless autoscaling.
  • Layer 4 and Layer 7 load balancing.
  • External and internal load balancing.
  • Global and regional load balancing.
  • Advanced feature support.

Benefits of Compute Engine –

There are some features of Compute Engine that make it an awesome choice.

1.Live Migration – It allows for live migration, so your app can keep running during maintenance mode without interruptions.

2. Right Size Recommendation – It provides sizing recommendations. For example, if you are using a bigger instance for a workload that can run on a smaller instance, then you can save costs using these recommendations.

3. Container Support – For container workloads, it supports deployment of containers.

What does it cost to use Compute Engine?

It is simple. You pay for what you use. But you can save costs by taking advantage of some discounts.

1. Sustained use discounts – Sustained use discounts are automatic discounts for running VM instances for significant portion of the billing month. These are applicable for instances created by Google Kubernetes Engine and Compute Engine.

2. Committed use discounts – Committed use discounts are ideal for workloads with predictable resource needs. These discounts are referred to as resource-based committed use discounts. These are applicable for instances created by Google Kubernetes Engine and Compute Engine.

3. Preemptible VM – A Preemptible Virtual Machine is a short-lived, cheaper compute instance. It can be purchased for a steep discount as long as the customer accepts that it will terminate after 24 hours. It is ideal for testing, batch jobs, and fault-tolerant applications.

Use Preempt VM’s if:

  • Your applications are fault tolerant.
  • You are very cost sensitive.
  • Your workload is not immediate.

Compute Engine Best Practices –

1.Choose Zone and Region based on:

  • Cost, Regulations, Availability Needs, Latency and Specific Hardware needs.
  • Distribute instances in multiple zones and regions for high availability.

2. Choose right machine type for your needs:

  • Play with them to find out the right machine type.
  • Use GPUs for Math and Graphic intensive applications.

3. Reserve for “committed use discounts” for constant workloads.

4. Use preemptible instances for fault-tolerant, non time critical workloads.

5. Use labels to indicate environment, team, business unit etc.

Stay tuned for the second part of this Google Compute Engine series. We will learn how to create a virtual machine instance using Google Cloud Console.

References –

To know more about Compute Engine, you can visit this link.

To read more tech blogs, feel free to visit Knoldus Blogs.

Written by 

Akshat Mathur is a Software Consultant at Knoldus Inc.. He has worked on Java, Angular 11 and Spring Boot for more than a year. Learning is his passion and solving problems is his forte.

2 thoughts on “Fundamentals of Google Compute Engine – Part 18 min read

Comments are closed.