Google Cloud Platform
Announcing gRPC Alpha for Google Cloud Pub/Sub
Internet RPC protocols have been notoriously inefficient, from XML stanzas to HTTP/JSON using unidirectional communications — gRPC to the rescue! Announced last year, gRPC is an open source RPC framework that came out of Google’s experience running much of our infrastructure using an internal version called Stubby. Not only is gRPC significantly more efficient than JSON/HTTP APIs, it supports most common languages and programming patterns idiomatic to building high performance clients and servers. Of course, we wanted to make this technology available for Google Cloud Platform customers. And today, we would like to invite you to try Google Cloud Pub/Sub with gRPC clients.
More impressive than the almost 3x increase in throughput, is that it took only 1/4 of the CPU resources. This is what the results look like in terms of throughput per CPU:
This 11x difference means that based on today's prices, instead of spending $334 a month on a n1-highcpu-16 virtual machine instance, you can spend $83.50 on a n1-highcpu-4 Compute Engine instance and still get 3x the throughput!
You must be wondering what is behind this improvement. There are two major factors at work here: more efficient data encoding and HTTP/2. gRPC keeps data in binary both in client memory and on the wire by building on HTTP/2 and Protocol Buffers. This eliminates processing and space required for string encoding schemes such as Base64 or JSON. In addition, HTTP/2 itself makes things go faster with multiplexed requests over a single connection and header compression.