DEV Community

Nguyễn Long
Nguyễn Long

Posted on

GCP compute options

Image description

Table of Contents

  1. Introduction
  2. Deep Dive into GCP Compute Options
    1. Google Compute Engine (GCE) – Virtual Machines
    2. Google Kubernetes Engine (GKE) – Container Orchestration
    3. App Engine – Platform-as-a-Service (PaaS)
    4. Cloud Functions
  3. Comparison Table

Introduction:

💡 So, you’re building something cool on GCP, and now you need to pick the right compute option. It's like standing in front of a vending machine of cloud services: “Do I want a classic virtual machine? Or should I get some fancy containers? Maybe I'll go serverless and just have it magically work.”

In Google Cloud Platform, you’ve got choices—and lots of them. But don’t worry, it’s not as confusing as picking the perfect avocado. Let’s break it down, step by step, with a little fun along the way. Think of each compute option like different modes of transportation:

  • 💻 Virtual Machines (VMs): You’re driving your own car. Full control, but hey, you’ve got to maintain it
  • ☸️/🐳 Containers (GKE/Cloud Run): Hop on a public bus. You are sharing, but it's efficent and flexible.
  • 🌍 Serverless (App Engine/Cloud Funcion): Teleportation... You dont know how, but you're there when you need to be.

Deep Dive into GCP Compute Options

1. Google Compute Engine (GCE) – Virtual Machines

VMs💻 are called instance andd need to choose region and zone to deploy.
You choose the OS and specify the application you put on it.

GCE provides traditional virtual machines that give you complete control over the operating system and infrastructure. You manage everything: scaling, patching, and maintaining the VMs. This is ideal for legacy applications, specialized workloads that need specific OS configurations, or high-compute tasks that demand fine-grained control.

Features:

  • Full control over OS
  • Custom VM type ot predefined ones
  • Suitable for workloads that require specific lib or frameworks
  • Manging multiple instances using instance groups
  • Add/remove capacity using autoscaling with instance groups
  • Attach/detach disks as needed.
  • Can SSH directly

Use Cases:

  • Hosting legacy applications that aren’t easily containerized.
  • Running high-performance computing (HPC) tasks or workloads that need fine-tuning
  • Applications that require stateful operations

Let’s say you’re running a finance application that needs specific security patches and configurations to meet regulatory compliance. VMs are perfect because you control every layer, including the OS.

2. ☸ Google Kubernetes Engine (GKE) – Container Orchestration

  • Is container-oschestration system for automating deploying,scaling and managing containers
  • Built in* open-source Kubernetes*
  • Flexibility to inegrate with on-premise Kubernetes.
  • Uses compute engine instances as nodes in a clusters ☸
  • Cluster is group of nodes or compute engine instances.

Features:

  • Automatic scaling and self-healing containers.
  • Runs across multiple zones for redundancy.
  • Integrates with Google’s stack, like Cloud Monitoring and Logging.

Use Cases:

  • Running microservices architectures, where each service can scale independently.
  • Applications that need high availability across zones.
  • Workloads requiring container orchestration with easy management.

🧠 Think of an ecommerce app that needs independent scaling for different services (checkout, inventory, recommendations). With GKE, you deploy each service in a container, ensuring that traffic spikes on one service don’t affect the others.

3.🚀 App Engine – Platform-as-a-Service (PaaS)

  • Fuly managed, serverless platform for developing and hosting web applications at scale (PaaS)

Features:

  • Provisions servers and scales your app instances based on demand
  • Build your app by favourite lanaguage
  • Connect with GG services seamlessly like Firestore, Cloud SQL, and Pub/Sub.
  • Integrates with Web sec scanner to identify threats.

👉 App Engine is a fully managed platform that abstracts away infrastructure management. You focus on writing your code while App Engine handles everything from scaling to monitoring. It’s great for developers who want to focus on code, not infrastructure.

4. Cloud Function (λ)

Serverless Execution env for building & connecting cloud service

Features:

  • Simple, single-purpose functions that are attached to events
  • Triggerd when an event being watched is fired
  • Your code executes in a fully managed env
  • No need to provision any infrastructure
  • Event-driven: Automatically executes in response to triggers.
  • Scales automatically with traffic.
  • Perfect for lightweight, short-duration tasks.

Use case:

  • ETC
  • hook
  • APIs
  • Mobile backend functions
  • FaaS

Comparison Table:

Service Type Management Level Scaling Cost Model Best For
Compute Engine VMs Full control Manual or autoscaling Pay for uptime Legacy apps, specialized OS control
Kubernetes Engine (GKE) Container orchestration Managed Automatic, multi-zone availability Pay for instance uptime Microservices, high availability
Cloud Run Serverless containers Fully managed Scales to zero Pay per request Stateless apps, event-driven microservices
App Engine PaaS Fully managed Automatic, scales based on traffic Pay per instance uptime Web apps, mobile backends
Cloud Functions Serverless functions Fully managed Automatic, scales to zero Pay per execution Event-driven, lightweight tasks

Top comments (0)