Check out our new GPU Glossary! Read now
September 25, 202412 minute read
Google Cloud Run vs. Cloud Run Functions: understanding Google's serverless offerings
author
Yiren Lu@YirenLu
Solutions Engineer

Introduction

Google Cloud offers two primary serverless computing options: Cloud Run and Cloud Run Functions. While their names are similar, these services cater to different use cases and offer distinct features. This article aims to clarify the differences between these two offerings and help you choose the right one for your project.

The evolution of Google’s serverless platform

To understand the current landscape, it’s helpful to look at the evolution of Google’s serverless offerings:

  1. Cloud Functions (1st gen): Introduced in February 2016, this was Google’s initial serverless offering for simple, event-driven functions.

  2. Cloud Run: Launched later as a more flexible, container-based serverless platform.

  3. Cloud Functions (2nd gen): Released in August 2022, bringing significant improvements over the first generation.

  4. Cloud Run Functions: On August 21, 2024, Google rebranded Cloud Functions as Cloud Run Functions, merging the infrastructure with Cloud Run.

This evolution reflects Google’s effort to unify its serverless offerings while maintaining distinct services for different use cases.

Cloud Run: Container-based serverless computing

Cloud Run is a fully managed serverless platform that allows developers to run stateless containers. It’s designed for deploying and scaling containerized applications with minimal infrastructure management.

Key features of Cloud Run

  1. Container-based: Supports any language, library, or binary that can be containerized.
  2. Flexible scaling: Automatically scales based on incoming requests, including scaling to zero.
  3. Fine-grained billing: Pay only for the exact resources used, billed to the nearest 100 milliseconds.
  4. HTTP/2 and HTTPS support: Automatic SSL certificate provisioning and HTTP/2 support.
  5. Custom domains: Ability to map custom domains to services.
  6. Concurrency: Supports handling multiple requests within a single container instance.
  7. GPU support: Access to GPUs for compute-intensive workloads like ML inference.
  8. VPC connectivity: Secure access to resources in Virtual Private Cloud networks.
  9. Event-driven capabilities: Integration with Eventarc for various event types.

Cloud Run Functions: Simplified function-as-a-service

Cloud Run Functions, formerly known as Cloud Functions, is a serverless execution environment focused on single-purpose functions that respond to events or HTTP requests.

Key features of Cloud Run Functions

  1. Function-centric: Deploy individual functions written in supported languages.
  2. Event-driven: Primarily designed for event-driven architectures.
  3. Automatic scaling: Scales based on incoming events or requests.
  4. Simplified development: Focus solely on writing function code without container management.

It’s worth noting that Cloud Run Functions inherits many capabilities from Cloud Run, including GPU access which is currently in preview. This inheritance allows developers to leverage powerful Cloud Run features within a more focused, function-based environment.

Key differences between Cloud Run and Cloud Run Functions

While both services are part of Google’s serverless ecosystem, they have distinct characteristics:

  1. Deployment model:

    • Cloud Run: Deploy entire containerized applications.
    • Cloud Run Functions: Deploy individual functions in supported languages.
  2. Abstraction level:

    • Cloud Run: Lower level, offering more control over the runtime environment.
    • Cloud Run Functions: Higher level of abstraction, focusing on single-purpose functions.
  3. Container management:

    • Cloud Run: Requires building and managing your own containers.
    • Cloud Run Functions: Handles container management automatically.
  4. Use cases:

    • Cloud Run: Suitable for longer-running services, web applications, and more complex architectures.
    • Cloud Run Functions: Ideal for short-lived, event-based actions and simple API endpoints.
  5. Development experience:

    • Cloud Run: More flexible, allowing use of any runtime or library that can be containerized.
    • Cloud Run Functions: Simpler for developers who want to focus solely on function code.
  6. Pricing model:

    • Cloud Run: Billed based on container instance time and resource allocation.
    • Cloud Run Functions: Billed based on function execution time and memory usage.

Choosing between Cloud Run and Cloud Run Functions

Use Cloud Run when:

  • You need more control over the runtime environment or custom libraries.
  • You’re deploying existing containerized applications.
  • You require longer-running services or complex web applications.
  • You want the flexibility to use any programming language or framework.

Use Cloud Run Functions when:

  • You need to quickly implement simple, event-driven code.
  • Your team prefers focusing on code without managing infrastructure details.
  • You’re working with short-lived, event-based actions triggered by cloud services.
  • You want a higher level of abstraction and simplified deployment process.

Conclusion

To get started with either service or to explore which option is best for your use case, visit the official Google Cloud documentation for Cloud Run and Cloud Run Functions.

Ship your first app in minutes.

Get Started

$30 / month free compute