Having just looked into this recently, I can also safely say that moving to REST HTTP/2 on its own already provides a significant speed benefit. Closing the gap to GRPC (or even substantially beating it) is possible by switching to a fast serialization format (eg; flatbuffers, msgpack, capnproto). While GRPC has its place it also comes with headaches like pretty lousy generated interfaces, horrible debuggability, and…
It's kinda weird to compare REST to RPC protocols though. It's a completely different paradigm. Maybe you're just building a HTTP API without the REST part? (JSON-RPC is a thing)
RPC Olympics – The Search for the Perfect RPC Protocol
31–40 of 71 posts
Re: RPC Olympics – The Search for the Perfect RPC Protocol
#32Strong recommendation for ZeroMQ as well. It's a thin layer on TCP, is very fast, offers bindings in many languages, and is fairly flexible as well. https://zeromq.org/
Re: RPC Olympics – The Search for the Perfect RPC Protocol
#33I recently spent some time between raw UDP and GRPC and learned a ton. This was for a hardware project so it's different from what web devs typically work on. The most important thing that I found out while doing my research is it's not the fastest bytes that win. Well, that does matter, but it's not that important. It's reducing performance variance [1]. While my project wasn't optimizing for speed, it was optimizin…
Re: RPC Olympics – The Search for the Perfect RPC Protocol
#34Having just looked into this recently, I can also safely say that moving to REST HTTP/2 on its own already provides a significant speed benefit. Closing the gap to GRPC (or even substantially beating it) is possible by switching to a fast serialization format (eg; flatbuffers, msgpack, capnproto). While GRPC has its place it also comes with headaches like pretty lousy generated interfaces, horrible debuggability, and…
It's kinda weird to compare REST to RPC protocols though. It's a completely different paradigm. Maybe you're just building a HTTP API without the REST part? (JSON-RPC is a thing)
Section 3.5 "Moving code styles" (and 3.4 for RPC):
https://www.ics.uci.edu/~fielding/pubs/dissertation/net_arch...
Re: RPC Olympics – The Search for the Perfect RPC Protocol
#35Should include smf[0]. [0] https://github.com/smfrpc/smf
I would not consider using it for production code either.
Re: RPC Olympics – The Search for the Perfect RPC Protocol
#36Earlier quoted context omitted.
Be careful using the pickle format; it's not considered safe to unpickle untrusted data. https://docs.python.org/3/library/pickle.html
You beat me to it. Sounds like you would be opening yourself up to a variant of CSRF. One user could upload untrusted data that would be fed into an unsuspecting user. You should never feed or consume an untrusted pickle.
Another issue is painting yourself into a corner: when you use pickles, you make it harder to either switch away from python in the future or consume the same serialized objects from any non-python (micro)service. This can delay or prevent transitions away from python that would otherwise make sense.
Re: RPC Olympics – The Search for the Perfect RPC Protocol
#37Cool! I don't know if a comparison of these really makes sense. You'd be conflating transport, serialization, and stream format (unary/stream). For fullstack dev, I've been immensely happy with grpc/protobuf over http because of the type safety I get communicating between Golang and Typescript. This eliminates a whole class of bugs but is only a serialization benefit. Generally: use the thing with the best tooling!
There is no type safety in grpc or any other protobuf RPC scheme, full stop. The recipient of a message makes an assumption about the meaning of the message and decodes it accordingly. Any encoded protobuf might successfully decode as any other protobuf. To repeat, grpc has no "type safety" whatsoever.
Re: RPC Olympics – The Search for the Perfect RPC Protocol
#38TCP has no concept of a message, you need to build it on top of TCP.
Which HTTP does, but it doesn't have a standard concept of a message format, you need to build it top of HTTP.
Which gRPC does, but it closes the connection after a successful exchange.
Which is avoided by streaming gRPC - makes sense if you know you'll be talking more over this channel.
None of those protocols are really comparable, and most of the differences boil down to the serialisation protocol (binary/proto or textual, like JSON).
Re: RPC Olympics – The Search for the Perfect RPC Protocol
#39Apples to oranges. TCP has no concept of a message, you need to build it on top of TCP. Which HTTP does, but it doesn't have a standard concept of a message format, you need to build it top of HTTP. Which gRPC does, but it closes the connection after a successful exchange. Which is avoided by streaming gRPC - makes sense if you know you'll be talking more over this channel. None of those protocols are really comparab…
Re: RPC Olympics – The Search for the Perfect RPC Protocol
#40Strong recommendation for ZeroMQ as well. It's a thin layer on TCP, is very fast, offers bindings in many languages, and is fairly flexible as well. https://zeromq.org/
especially when you use the router pattern on server side in order to have multiple sessions on the same socket.