Use gRPC but wish you didn't? You're in luck!
DRPC is a lightweight, drop-in, protocol buffer-based gRPC replacement. The DRPC protocol strips out huge swaths of unnecessary complexity; it is implemented in just a few thousand lines of straightforward Go! DRPC is small, extensible, efficient, and can still be autogenerated from your existing Protobuf definition files.
Check out our launch blog post >DRPC works with the protoc
compiler to generate RPC
stubs for you.
$ go get storj.io/drpc/cmd/protoc-gen-go-drpc
$ protoc --go_out=. --go-drpc_out=. sesamestreet.proto
message Cookie {
enum Type {
Sugar = 0;
Oatmeal = 1;
Chocolate = 2;
}
Type type = 1;
}
service CookieMonster {
rpc EatCookie(Cookie) returns (Crumbs) {}
}
At just a few thousand lines of code (including tests), DRPC's enemy is complexity. The state machines are straightforward and simple, there are no hard to debug and diagnose issues, it's just message passing over good old connection-oriented sockets. DRPC does not support concurrent RPCs over a single transport. This eliminates head-of-line blocking concerns, buffering issues, and dramatically simplifies the implementation. Trying to force HTTP/2 into this use case is a specific non-goal, which helps the package have a small binary size and very few dependencies.
Care has been taken to preserve gRPC semantics wherever possible. We designed this library to replace our own use of gRPC, and so it supports singleton requests, streaming requests, and gets the error code handling right. It supports metadata (e.g. distributed tracing) and even serving requests over HTTP.
DRPC can be used independently or can be used alongside gRPC. It can be served from the same sockets to support easy live migrations.
Read more about our migration experience in our launch blog post.
DRPC has a small framing format designed around network
and CPU efficiency. DRPC is transport agnostic, supports
net/http
-style middleware, and is designed
around clean interfaces.
DRPC has been used in production for years across tens of thousands of servers across the internet. With less code for bugs to hide in, every second of production experience becomes more valuable.
Check out our documentation.