The Server: gRPC & Protobuf

GSOC Week 3@SCoRe Lab

Dhruvi Doshi
SCoRe Lab
2 min readJul 13, 2022

--

This week started off with creating the C&C Server. The server is built using gRPC.

gRPC ?

gRPC is a modern open source high performance Remote Procedure Call (RPC) framework that can run in any environment. This is a good article that might convince you if you gotta ask “why gRPC?”.

That is its main advantage over REST: gRPC, in most cases, is way faster and more robust, as it defines a specific set of rules each request and response should adhere to.

By default, gRPC uses Protocol Buffers, Google’s mature open source mechanism for serializing structured data (although it can be used with other data formats such as JSON).

For most of the message transfers of our project, we too use the protobuf!

Protocol Buffers

Protocol buffers are Google’s language-neutral, platform-neutral, extensible mechanism for serializing structured data — think XML, but smaller, faster, and simpler.

Protocol Buffers support a wide variety of languages and data types. The official documentation of protocol buffers is very well maintained & easy to understand.

So, in this week, I sat down to write the protobuf definitions for Survey6. The services mainly include connecting/disconnecting the probes to/from the server and the health check mechanism. The definitions include the function calls and the message formats. I kept in mind this style guide to maintain the quality of my code at the same time.

P.S: Protobufs also support Timestamp datatype :)

Directory structure was also setup during this week. Python3 does no more require __init__.py to initialize a package. A lovely guide to python packaging and modules is here.

I hope this helps :)

Up Next: Setting up system service & connecting to database.

--

--