Source: 3 cool Cloud Run features that developers love—and that you will too from Google Cloud
Earlier this year, we announced Cloud Run, a managed serverless compute platform for stateless containers. Cloud Run abstracts away infrastructure management, and makes it easy to modernize apps. It allows you to easily run your containers either in your Google Kubernetes Engine (GKE) cluster with Cloud Run on GKE or fully managed with Cloud Run.
Cloud Run has lots of great features and you can read the full list on the webpage. But in conversations with customers, three key features of the fully managed version of Cloud Run stand out:
Pay for what you use pricing
Once above the always free usage limits, Cloud Run charges you only for the exact resources that you use.
For a given container instance, you are only charged when:
During that time, Cloud Run bills you only for the allocated CPU and memory, rounded up to the nearest 100 milliseconds. Cloud Run also charges for network egress and number of requests.
As shared by Sebastien Morand, Team Lead Solution Architect at Veolia, and Cloud Run developer, this allows you to run any stateless container with a very granular pricing model:
“Cloud Run removes the barriers of managed platforms by giving us the freedom to run our custom workloads at lower cost on a fast, scalable and fully managed infrastructure.”
Read more about Cloud Run pricing here.
Concurrency > 1
Cloud Run automatically scales the number of container instances you need to handle all incoming requests or events. However, contrary to other Functions-as-a-Service (FaaS) solutions like Cloud Functions, these instances can receive more than one request or event at the same time.
The maximum number of requests that can be processed simultaneously to a given container instance is called concurrency. By default, Cloud Run services have a maximum concurrency of 80.
Using a concurrency higher than 1 has a few benefits:
Read more about the concept of concurrency here.
Secure event processing with Cloud Pub/Sub and Cloud IAM
Your Cloud Run services can receive web requests, but also other kinds of events, like Cloud Pub/Sub messages. We’ve seen customers leverage Cloud Pub/Sub and Cloud Run to achieve the following:
The messages are pushed to your Cloud Run container instances via the HTTP protocol. And leveraging service accounts and Cloud IAM permissions, you can securely and privately push messages from Cloud Pub/Sub to Cloud Run without having to expose your Cloud Run service publicly. Only the Cloud Pub/Sub subscription that you have set up is able to invoke your service.
You can achieve this with the following steps:
Run, don’t walk, to serverless containers
These are just a few of the neat things that developers appreciate about Cloud Run. To learn about all the other things to love about Cloud Run, check out these Cloud Run Quickstarts.