When to use Google App Engine Flex vs Google Cloud Run

hlp picture hlp · Apr 15, 2019 · Viewed 11.9k times · Source

I want to deploy containerized code using one of Google's serverless options. From what I understand Google has two options for this:

  1. Google App Engine Flexible Environment
  2. Google Cloud Run (in beta)

I've watched the 2019 Google Next talk Where Should I Run My Code? Choosing From 5+ Compute Options. And I read Jerry101's answer to the general question "What is the difference between Google App Engine and Google Cloud Run?".

To me it basically sounds like Cloud Run is the answer to the limitations of using Google App Engine Flexible Environment.

The reasons I can think of to choose App Engine Flexible Environment over Cloud Run are:

  • Legacy - if your code currently relies on App Engine Flex you might not want to deal with moving it
  • Track record - App Engine Flex has been around for a while in general availability and in that sense has a track record, whereas Cloud Run is just in Beta

But those are both operation type considerations. Neither is a concern for me. Is there a technical advantage to choosing App Engine Flex over Cloud Run?

Thanks

Note: The beta Serverless VPC Access for App Engine is only available for the standard environment as of this question posting April 2019, not for Flex, so that's not a consideration in the question of App Engine Flex vs Cloud Run

Answer

AhmetB - Google picture AhmetB - Google · Apr 15, 2019

Pricing/Autoscaling: The pricing model between GAE Flexible Environment and Cloud Run are a bit different.

  • In GAE Flexible, you are always running at least 1 instance at any time. So even if your app is not getting any requests, you’re paying for that instance. Billing granularity is 1 minute.
  • In Cloud Run, you are only paying when you are processing requests, and the billing granularity is 0.1 second. See here for an explanation of the Cloud Run billing model.

Underlying infrastructure: Since GAE Flexible is running on VMs, it is a bit slower than Cloud Run to deploy a new revision of your app, and scale up. Cloud Run deployments are faster.

Portability: Cloud Run uses the open source Knative API and its container contract. This gives you flexibility and freedom to a greater extent. If you wanted to run the same workload on an infra you manage (such as GKE), you could do it with "Cloud Run on GKE".