When to use Google App Engine Flex vs Google Cloud Run
Asked Answered
M

7

82

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

Martial answered 15/4, 2019 at 19:48 Comment(0)
E
74

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".

Embolden answered 15/4, 2019 at 20:49 Comment(1)
Thanks for this helpful technical answer. I wonder if you could add something to it about App Engine's ability to do traffic splitting between service versions, and how that compare's to Cloud Run? I see there's some documentation on the latter but I'm not sure if there are any notable technical differences - cloud.google.com/run/docs/rollouts-rollbacks-traffic-migrationRinged
D
23

I'd actually suggest that you seriously consider Cloud Run over App Engine.

Over time, I've seen a few comments of a "new" App Engine in the works, and it really seems that Cloud Run is that answer. It is in beta, and that can be an issue. I've seen some companies use beta services in production and others wait. However, if I am going to start a new app today - it's going to be Cloud Run over App Engine Flex for sure.

Google is very deep into Kubernetes as a business function. As Cloud Run is sitting on GKE - this means that it is indirectly receiving development via other teams (The general GKE infrastructure).

Conversely, App Engine is on some older tech. Although it's not bad - it is "yesterday's" technology. Google, to me, seems to be a company that gets really excited about what is new and what is being highly adopted in the industry.

All this said - when you wrap your services in a container, you should be able to run them anywhere? Well, anywhere there is a container platform. You can front your services with something like Cloud Endpoints and you can deploy on both App Engine and Cloud Run - swap back and forth. Then, at that point, the limitations might be the services that are offered. For instance, Cloud Run currently doesn't support some items, like Cloud Load Balancing or Cloud Memorystore. That might be a blocker today.

Dendro answered 8/10, 2019 at 17:18 Comment(3)
do you know if Cloud Run now supports Cloud Load Balancing?Campestral
@Campestral Sorry for the slow reply here. Yes, if you are talking about the Global Load Balancer there are steps in using it with Cloud Run instances across regions. If you are just looking to use a single region, then Cloud Run has it's own load balancer (naturally)Dendro
Cloud Memorystore / VPC now also seems supported cloud.google.com/memorystore/docs/redis/…Pennoncel
S
6

Short story: Appengine is something real, relatively stable. Cloud Run is pretty much just a draft/idea, very unstable.

Long story: Being in alpha/beta Google Cloud Run may suffer many changes. If you are old enough you might remember how dramatically Appengine pricing has changed. It promised a CPU/RAM based pricing, then it decided that's not "possible" or at least not very profitable and moved to a VM based pricing, then they shipped a decent appengine release(Appengine Flex or whatever name it had at that time) but also increased the price again by adding a minimum instance model. Not to mention the countless APIs/breaking changes or the limits changes.

Cloud Run is based on gVisor which has some limitations so depending on the language/library you use and what you do, it may break(or just Google's implementation may break) at some point and there is nothing you can do (i.e. patch the system) and it will ruin your productivity and potentially your business. You may have a look on its current issues.

Free advice: Even if you choose Appengine or Cloud Run avoid proprietary APIs/services such Google Datastore. They may ruin your business. Pricing, APIs and limits will change. There is no real open source or paid alternative so your code is not portable. Your code is pretty worthless outside of Google cloud.

Disclaimer: I've been burned by appengine changes and datastore lock-in so my opinion may be biased.

Scudder answered 13/7, 2019 at 8:37 Comment(4)
"They may ruin your business" - They may also help you to dramatically cut costs and decrease development time while also helping you build a more scalable platform. But your mileage may vary. Honestly: claiming you should avoid all proprietary APIs/services is overly simplistic.Deluca
@Deluca Google knows to market the benefits well so there is no need to further reinforce their arguments. However from my experience running over 60 micro-services on appengine(at my peak deployment on appengine)the costs are actually higher (after google finally decides the pricing) and the risks are high. You can't avoid all proprietary APIs but you can avoid APIs core to your service(i.e. database). The lack of portability is very frustrating. I have so many horror stories to share about this...Think of lock-in like of diseases. You can't avoid them all but you can avoid the worst of themScudder
anyone else wary of using Google Datastore?Ferro
If you're worried about being able to use your software outside of GCP then use Google Anthos. Makes an app portable between on-premises or in-cloud.Repudiation
U
4

I have a ML model with REST API interface as a micro service. When I tried to run with Cloud Run, it deploys but just does not work. I had to switch back to App Engine Flexible Env.

Cloud Run (fully managed) currently (Jul 2020) has RAM limitation of 2GB. For better hardware I should go for Anthose with GKE infra. But this has min instance needs of at least 4 instances to properly work. Mine being a tiny application I settled for App engine Flexible environment. Though autoscale settings required min 2 instances, in early days it could be managed with manual scaling and 1 instance as limit.

EDIT: As on Aug 22 2020, the RAM limit is 4GB and number of cores is 2, for fully managed GCP cloud Run.

Uncivil answered 7/7, 2020 at 7:23 Comment(0)
F
3

Main difference is background tasks.

In cloud run, everything kicks off by a request, and once that request completes, the instance won't be up up any longer.

App Engine also gave you some built in freebies like memory caching, but I don't think that's true of App Engine flex.

For a straightforward HTTP API, the differences are negligible, and you can get some of the things that App Engine gives you with other GCP products (Cloud Scheduler, Cloud Task).

You can check this video out for a comparison and demo on cloud run: https://www.youtube.com/watch?v=rVWopvGE74c

Flint answered 4/12, 2021 at 3:11 Comment(0)
H
2

App Engine Flexible, focus on "Code first", developer-focused, App Engine app was made up of multiple services, you really didn't have to do any kind of naming when deploying your applications.

Characteristics of the GAE flexible environment :

  • It is not possible to downscale to ZERO
  • Source code that is written in a version of any of the supported programming languages: Python, Java, Node.js, Go, Ruby, PHP, or .NET
  • Runs in a Docker container that includes a custom runtime or source code written in other programming languages.
  • Uses or depends on frameworks that include native code.
  • Accesses the resources or services of your Google Cloud project that reside in the Compute Engine network.
  • Maximum request timeout: 60 minutes

Cloud Run is a managed compute platform that enables you to run containers that are invocable via requests or events, everything is a service, whether it's an actual service or an application with a web interface, so consider its use as the deployment of a service rather than an appplication.

Characteristics of Cloud Run :

  • It is serverless: it abstracts away all infrastructure management
  • It depends on the fact that your application should be stateless.
  • GCP will spin up multiple instances of your app to scale it dynamically
  • Downscale to ZERO
Hauser answered 5/8, 2021 at 9:7 Comment(0)
A
0

You can use below url to get difference between Cloud Run and App Engine. Hosting Options

Some times many reason to use App Engine over the Cloud Run is, Cloud Run doesn’t Background processes. It response time also 15 mins only.

Amalle answered 11/9, 2021 at 14:8 Comment(1)
Cloud Run can have a timeout set up to 60 minutes. If you need more than an hour to run your process, you should consider GKE. App Engine is ok, but I would recommend GKE over App Engine at this time. You can run background processes on Cloud Run. However, you would use another tool like Cloud Scheduler, Cloud Task, etc... to start them.Dendro

© 2022 - 2024 — McMap. All rights reserved.