Cloud Run¶
Cloud Run is a managed compute platform
that lets you run stateless containers via web requests or Pub/Sub events.
Cloud Run is serverless; That means it removes all infrastructure management tasks so you can focus on developing applications.
It is built on Knative, an open API and runtime environment built on Kubernetes. It can be fully managed on Google Cloud, on Google Kubernetes Engine, or anywhere Knative
runs.
Cloud Run is fast. It can automatically scale up and down from zero almost instantaneously, and it charges only for the resources used, calculated down to the nearest 100 milliseconds, so you‘ll never pay for over-provisioned resources
==You can deploy code written in any programming language on Cloud Run if you can build a container image from it.
Do we need to build containers?
In fact, building container images is optional. If you're using Go, Node.js, Python, Java, .NET Core, or Ruby, you can use the source-based deployment option that builds the container for you, using the best practices for the language you're using.
When to use Cloud Run services?
Cloud Run services are great for code that handles requests or events. Example use cases include:
-
Websites and web applications: Build your web app using your favorite stack, access your SQL database, and render dynamic HTML pages.
-
APIs and microservices: You can build a REST API, or a GraphQL API or private microservices that communicate over HTTP or gRPC.
-
Streaming data processing: Cloud Run services can receive messages from Pub/Sub push subscriptions and events from Eventarc.
Pricing Model¶
The pricing model on Cloud Run is unique; as you only pay for the system resources you use while a container is handling web requests, with a granularity of 100ms, and when it is starting or shutting down.
You do not pay for anything if your container does not handle requests. Additionally, there is a small fee for every one million requests you serve.
The price of container time increases with CPU and memory. A container with more vCPU and memory is more expensive. Today, Cloud run can allocate up to 4 vCPUs and 8GB of memory.
Most of the other compute products (such as Compute Engine), charge for servers as long as they are running, even if you are not using them. That means you’re often paying for idle server capacity.