Google Cloud Big Data and Machine Learning Blog

Innovation in data processing and machine learning technology

Announcing gRPC Alpha for Google Cloud Pub/Sub

Tuesday, March 22, 2016

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.

As an illustration of what you might expect compared to the current JSON/HTTP client libraries, we ran a benchmark using the Java client publishing 50KB messages at maximum throughput from a single n1-highcpu-16 Google Compute Engine Virtual Machine instance, using 9 gRPC channels.

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.

It's easy to get started with our public Alpha of Pub/Sub gRPC surface. Check out our updated Pub/Sub documentation and send us your thoughts on the Pub/Sub Google Group. The documentation offers examples in Java and Python to get you going.

Posted by Emilio Schapira, Tech Lead for Google Cloud Pub/Sub and Kailash Sethuraman, Technical Program Manager for gRPC

  • Big Data Solutions

  • Product deep dives, technical comparisons, how-to's and tips and tricks for using the latest data processing and machine learning technologies.

  • Learn More

12 Months FREE TRIAL

Try BigQuery, Machine Learning and other cloud products and get $300 free credit to spend over 12 months.


Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.