Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gRPC / Protobuf interface versioning

Let's say we use gRCP/Protobuf to connect many application. Those application are developped and released at their own team, with their own speed. Over time there will be different version of the the same app (e.g. desktop apps install on user PCs) that use different version on defined interface.

While Protobuf is meant to allow backward compatibility, is there a way to know what version of interface is running at different points?

The simplest implementation is to have interface version equal to app version. But as many languages are used, it is not trivial to implement app versioning in all of them.

So how version interface and let server to know client version? I think server should be able to log

DATETIME connection from AppName v.version [using interface v.version]

like image 694
Paul Verest Avatar asked Nov 10 '16 03:11

Paul Verest


People also ask

What version of Protobuf does gRPC use?

protoc compiler If you don't have it already, you need to install the protobuf compiler protoc , version 3.5. 0+ (the newer the better) for the current gRPC version.

Is gRPC backwards compatible?

Backwards compatibility. The gRPC protocol is designed to support services that change over time. Generally, additions to gRPC services and methods are non-breaking. Non-breaking changes allow existing clients to continue working without changes.

Does gRPC use Protobuf?

Protobuf is the most commonly used IDL (Interface Definition Language) for gRPC. It's where you basically store your data and function contracts in the form of a proto file.

Is Protobuf backwards compatible?

It can accept input crafted by later versions of protobuf. The sender is backward compatible because it's creating output that can be consumed by earlier versions. So long as you're careful about when and how you change and remove fields, your protobuf will be forward and backward compatible.

How does Protobuf work with gRPC?

Changing a field number - With Protobuf payloads, the field number is used to identify fields on the network. Renaming a package, service or method - gRPC uses the package name, service name, and method name to build the URL. The client gets an UNIMPLEMENTED status from the server.

Can Protobuf know what version of interface is running at different points?

While Protobuf is meant to allow backward compatibility, is there a way to know what version of interface is running at different points? The simplest implementation is to have interface version equal to app version.

What are gRPC and Protocol Buffers?

An introduction to gRPC and protocol buffers. This page introduces you to gRPC and protocol buffers. gRPC can use protocol buffers as both its Interface Definition Language ( IDL) and as its underlying message interchange format. If you’re new to gRPC and/or protocol buffers, read this!

What versioning strategy should be implemented to support changes to gRPC?

A versioning strategy to support changes should be implemented. The gRPC protocol is designed to support services that change over time. Generally, additions to gRPC services and methods are non-breaking. Non-breaking changes allow existing clients to continue working without changes. Changing or deleting gRPC services are breaking changes.


1 Answers

In the upcoming versions of gRPC, there will be a new feature called Server Reflection. This will allow a client to ask the server for the Descriptors that descriptor the proto file being used. Rather than the server knowing about the version the client is running, the client will know what the server is running. If the server descriptor matches the one the client already has, then it will know that they are speaking at the same version.

This will be released in version 1.1.

Note that Protobufs are designed so that you don't have to do this! If you set up your proto correctly, old and new versions of clients and server should work together.

like image 132
Carl Mastrangelo Avatar answered Sep 28 '22 08:09

Carl Mastrangelo