Comparing Google's Serverless Offerings: Cloud Run, Cloud Functions, App Engine

Google made over 122 different announcements, spanning its offerings in infrastructure, application development, data management/analytics, AI, productivity, and more.

Of particular interest to developers operating serverless platforms is the availability of Google Cloud Run. Alongside Google App Engine and Cloud Functions, Cloud Run presents additional choices for developers considering serverless deployments on Google Cloud. Let’s review why you might want to build serverless applications, compare Google’s serverless offerings, and when you should choose one over another.

Getting to the Fun Part

The main benefit of serverless platforms is that they let you focus on writing code without worrying about managing infrastructure, auto-scaling, or paying for more than what you use.

This makes serverless computing ideal for use cases such as:

  • Stateless HTTP applications
  • Web and mobile backends
  • Real-time or event-driven data processing

Cloud Run, Cloud Functions, and App Engine are all serverless platforms offered by Google Cloud, but they have nuances that can make one preferable to the other in certain situations.

Google Cloud Run: Serverless Containers

Built from Knative, Cloud Run is the latest of Google’s serverless offerings. While other serverless platforms use event-driven functions as the main unit of deployment, Cloud Run enables you to package code in a stateless container, then invoke it via HTTP requests.

Deploying Cloud Run containers in Google’s fully managed environment provides developers with the usual benefits of serverless (no infrastructure management, usage-based pricing, easier auto-scaling), but also supports any number of programming languages, libraries, or system binaries. Cloud Run can also deploy containers on Google Kubernetes Engine (GKE), with the ability to specifically configure hardware requirements for your serverless containers in the latter case.

With this flexibility, users of Cloud Run can easily run serverless workloads with tools they already use to package and run containers on Google Cloud, or deploy stateful and stateless workloads together.

Google Cloud Functions: Serverless Functions

While Cloud Run takes containers and makes them invocable via HTTP requests, Cloud Functions remain as Google’s event-driven serverless platform. As opposed to being packaged in a Docker container, you deploy code as functions. Google supports writing Cloud Functions so they can also be called via HTTP requests, or set to trigger based on background events.

def hello_get(request):

    """HTTP Cloud Function.


        request (flask.Request): The request object.



        The response text, or any set of values that can be turned into a

        Response object using `make_response`



return 'Hello World!'

Hello World, written as an HTTP Cloud Function

Cloud Functions places more constraints on how your code is deployed (the obvious one being you need to package it as a function), and supports only a specific set of languages (you can write Cloud Functions using JavaScript/Node.js, Python 3, or Go runtimes), but offers the ability to trigger functions using events in your cloud environment.

Google App Engine: Serverless Applications

App Engine is Google’s fully managed serverless application platform for web and API backends. While serverless functions let you easily run lightweight and standalone pieces of functionality, it can be difficult to run more complex applications using Cloud Functions. For developers who want to build a serverless application with multiple pieces of functionality, or retain some level of context that survives beyond an individual request, Google App Engine presents a compelling option.

In Google App Engine, you simply take your code and deploy it on Google, then pay for the resources you consume – this runs on App Engine as a single resource consisting of one or more services. For each service, you deploy one or more versions of that service, which in turn run within one or more instances depending on the amount of traffic each version handles.

Deploying Hello World on Google App Engine with a single command from your app’s directory, shown above

Depending on your particular needs, you can run your code in one of two types of App Engine environment. Google recommends the standard environment when you want to run an application that needs to rapidly scale, written in a specific language version that App Engine supports. For applications that experience more consistent traffic, run in Docker containers with custom runtimes or non-supported programming languages, or access parts of your Google Platform project that run on Compute Engine, choose the App Engine Flexible Environment instead.

Deciding Between Cloud Run, Cloud Functions, and App Engine

In general, serverless platforms are best used to build stateless applications without needing to manage infrastructure. Some examples include:

  • Quickly prototyping a feature
  • Rapidly autoscaling a web application
  • Performing a task in response to background events

When deciding which of these serverless platforms is right for you, keep the following points in mind:

  • If you already package code in Docker containers or are running a Kubernetes cluster in Google Cloud, consider Cloud Run or Knative for your serverless workloads.
  • For running code that responds to real-time events, or for serving requests without containers, use Cloud Functions.
  • For when you need multiple pieces of functionality in a single place and want to just deploy your entire application, look to App Engine.

Google also provides a handy flowchart that you can find here, along with example use cases for each.

More Servers, More Problems

We’re incredibly excited by Google’s latest announcements around serverless computing, and in a broader sense, how serverless helps developers push the pace of software innovation. To learn specifically about monitoring serverless workloads on Google Cloud, you can read about how Splunk Infrastructure Monitoring provides real-time visibility for Knative, Cloud Run, and Google Cloud Functions.

If you’re not already using Splunk Infrastructure Monitoring, get started with a 14-day trial or observability demo

Aaron Sun

Posted by


Show All Tags
Show Less Tags