Jump to Content
Compute

Not just for HTTP anymore: gRPC comes to Cloud Run

March 17, 2020
Richard Belleville

Software Engineer

Wenlei He

Software Engineer

Cloud Run is a managed serverless compute offering from Google Cloud that lets you run stateless server containers in a fully managed environment, without the hassle of managing the underlying infrastructure. Since its release, Cloud Run has enabled many of our customers to focus on their business logic, while leaving the provisioning, configuring, and scaling to us. 

Most applications that run inside Cloud Run use HTTP JSON REST to serve requests, but that’s not the only protocol it supports; in September, it also started to support unary gRPC services.

gRPC is a high performance RPC framework developed by Google and used extensively for traditional workloads and at the edge by companies like Netflix, Cisco, Square, and others. While gRPC offers advantages over traditional HTTP, like strong interface definitions and code generation, setting up the infrastructure to run a gRPC server in production can be a real chore. Cloud Run takes the toil out of this process.

With gRPC, you start with a strong API contract in the form of a protocol buffer file:

Loading...

This interface definition ensures that your clients and servers speak the same language even as you extend the capabilities of your service. You then generate code from this definition in your desired language and provide an implementation for it:

Loading...

Cloud Run provides everything else you need to get your code serving traffic. You just need to put together a simple Dockerfile and run a few commands:

Loading...

We've put together additional examples in several languages to help you get started running a simple gRPC service in fully managed Cloud Run. We're excited to see the gRPC services you'll deploy!

Since this article was originally published, Cloud Run has added support for gRPC streaming, among other things. Now the only limit for gRPC on Cloud Run is your imagination!

Posted in