When to Choose GCP App Engine vs Cloud Run vs Cloud Function
Serverless computing lets the developer focus on what’s most important – development – and not have to worry about the underlying details of infrastructure and maintenance. Other benefits such as autoscaling, pay-as-you-go and on-demand provisioning make this a no-brainer if you are building stateless HTTP applications, web and mobile apps, IoT and sensor apps, data processing systems, chatbots and more. There are three offerings in Google Cloud Platform that should be considered, so let’s dive in.
GCP App Engine
GCP app engine is for building a serverless app with a web or API backend and supports several development languages without needing to worry about infrastructure support. When you have an application that needs to communicate with multiple services like a web app or API’s, Google Cloud App Engine is a suitable solution. The relationship among those services means the application is treated as a managed entity.
Google Cloud Functions
Event-driven solutions that extend to Google and 3rd party services are a good fit for cloud functions, as well as ones that need to scale quickly.
GCP App Engine vs Cloud Functions
While App Engine supports many different services within a single application, Cloud Functions support individualized services. If your requirements don’t include multiple services then Cloud Functions is a great choice.
For example, if you are saving or extracting data from a database, posting a file, or doing simple data validation, then using Cloud Functions is an appropriate choice.
Functions operate in their own runtime environment and run independently; when a function is invoked it runs in a separate instance from other function calls.
Unlike in GCP App Engine where data is shared among instances, once a function is invoked with Cloud Functions, it is on its own, so if you need to keep track of data when using Cloud Functions, you’ll need to use a database or writable file in Cloud Storage. Currently, GCP supports Node.js, Python and Go.
Google Cloud Run
Cloud Run is a serverless compute platform that is completely managed by Google, so you don’t have to worry about backend application support.
Cloud Run vs App Engine vs Cloud Functions
Unlike Google App Engine and Cloud Functions, Cloud Run can scale stateless containers and leverages Google Kubernetes Engine.
If you need a serverless option that needs an application to run in a stateless container, Cloud Run may be the best choice for this kind of deployment. It is fully managed, and the pricing is based only on resources consumed. Also if you have a mixed architecture with on-premises and cloud resources, Anthos, the GKE (Google Kubernetes Engine) serverless container option is available for Cloud Run, so it’s a great choice for these scenarios.
Choosing between App Engine, Cloud Functions and Cloud Run for your next application
There are nine areas that you need to look at to decide which GCP service you should use, so let’s explore these in a little more detail:
- Deployment Type
The delivery method to deploy the stateless application
Identify if scaling is possible and if it is, what method of scaling is enabled. Cloud Run for Anthos scales differently from a standard app.
- Runtime environment support
Language support varies between services in GCP. Cloud Run and Cloud Run/Anthos flavors support virtually all common languages, but App Engine and Cloud Functions support more limited language support.
- Access controls
There are different approaches to handling security and identity management for stateless applications in GCP and they each handle things a little differently.
Only Cloud Run with Anthos handles Cloud Endpoints management due to the mixed topology requirements
- Custom domains
Standalone and container-based applications support custom domain name mapping to your app, but the Cloud Functions platform does not.
- GPU/TPU support
Extended GPU capability using either graphics processing units (GPUs) or tensor processing units (TPUs) is only supported with Cloud Run for Anthos.
- Timeout (minutes)
The number of minutes before timeout with no activity is different between stateless deployment types. Cloud Run flavors both offer 15-minute timeout windows; Cloud Functions times out at 9 minutes, and App Engine at 1 minute.
- VPC Networking
All stateless applications except for Cloud Run allow for VPC networking. As of this writing, GCP does not have VPC networking in general availability.
Summary of GCP App Engine vs Cloud Run vs Cloud Functions
So there you have it. There are different characteristics to each approach, and the best choice for you depends on your application needs and your development preferences. If you need help with your app strategy amongst these architectural choices or development itself, we’re always here to help. Contact us today for a consultation.