When starting with gRPC there are many resources setting out what gRPC is, where it originated from and how to create basic service and client. All those tutorials do a very good job in helping the developers to get started using gRPC in their projects. We can find materials talking about gRPC server, stub client, interceptors, protobuf, encrypted connection, load balancing but hardly we find all this together and prepared for a real production scenario. Deployments to production are not discussed and available resources are sparse.
There are some projects that provide a collection of handy features that can help you to set up gRPC communication in a reliable way but they are all generic building blocks without an initial structure which you can envolve from.
I have gone through all this pain to collect all available materials and decided to create a library that provides the core requirements for a production-ready gRPC communication. As a natural opensource contributor, I could not make all this hard work available to the community and hopefully save people time.
This project abstracts away the details of the GRPC server and client configuration. Here are the main features:
Health check service — We use the grpc_health_probe utility which allows you to query health of gRPC services that expose service their status through the gRPC Health Checking Protocol.
Shutdown hook — The library registers a shutdown hook with the GRPC server to ensure that the application is closed gracefully on exit
Keep alive params — Keepalives are an optional feature but it can be handy to signal how the persistence of the open connection should be kept for further messages
In memory communication between client and server, helpful to write unit and integration tests. When writing integration tests we should avoid having the networking element from your test as it is slow to assign and release ports.
Server and client builder for uniform object creation
Ability to recover the system from a service panic
Ability to add multiple interceptors in a sorted order
Client tracing metadata propagation
Handy Server interceptors(Authentication, request cancelled, execution time, panic recovery)
Handy Client interceptors(Timeout logs, Metadata propagation)
Secure communication(TLS)
As you can see, the gRPC Server project has some handy features and it can save you time not having to write your own gRPC server bootstrap. If you are a developer or architect looking to create a new gRPC project with Golang this library will be very helpful.
Enough talking, check out the project here
Top comments (0)