Live data from Hacker News

RPC Olympics – The Search for the Perfect RPC Protocol

perimeterx.com

61–70 of 71 posts

Re: RPC Olympics – The Search for the Perfect RPC Protocol

#62
post #13

Earlier quoted context omitted.

It's not a normal procedure call within the same process.

Right. Those are methods for I PC. I PC doesn't have to deal with all the same issues as R PC, and so those techniques are going to be faster as a result. You can't really compare them. It's like comparing communication between people physically located in the same room and people located on different continents.

RDMA shared memory muddies that distinction.

Re: RPC Olympics – The Search for the Perfect RPC Protocol

#63
post #61

Couple of protocols that would be nice to benchmark for comparison: * AMQP 1.0 - can also be used for RPC without a broker in between client and server. See https://qpid.apache.org/proton/ * Aeron - low latency, UDP based, see https://github.com/real-logic/aeron

Re proton: I tried to use it in point-to-point mode, but haven't been able to figure out how; Javadoc reference is useless for that. There exist only Python examples but Python APIs don't map 1:1 to Java APIs.

Re: RPC Olympics – The Search for the Perfect RPC Protocol

#64
I think it comes to no surprise that sending data through a plain TCP socket is faster than using gRPC. The only downside is that over time requirements will likely start to stack up:

- Suddenly you want to enable TLS between one or more components, meaning you need to wrap the socket inside a TLS channel.

- You discover that your client behaves poorly when servers go offline, so you add your own logic for keepalives/pings.

- At some point you want to add metrics to all of this, so you decide to manually add Prometheus metrics to the client/server.

- Later on you want to attach OAuth2 tokens to requests as well, so that you can do credential passing.

- In order to get more insight in your setup, you decide that you want to use this in combination with OpenTracing/Jaeger.

Once all of those features are added to your Redis-like protocol, you discover that you've basically reinvented gRPC... poorly.

Re: RPC Olympics – The Search for the Perfect RPC Protocol

#65
post #63
post #61

Couple of protocols that would be nice to benchmark for comparison: * AMQP 1.0 - can also be used for RPC without a broker in between client and server. See https://qpid.apache.org/proton/ * Aeron - low latency, UDP based, see https://github.com/real-logic/aeron

Re proton: I tried to use it in point-to-point mode, but haven't been able to figure out how; Javadoc reference is useless for that. There exist only Python examples but Python APIs don't map 1:1 to Java APIs.

For Java, have a look at vertx-proton which builds on top of proton-j and is a bit more intuitive (still not great) than proton-j for creating servers and clients. :)

Example “blocking” client https://github.com/EnMasseProject/enmasse/blob/master/amqp-u... , but might give an idea of how to set “dynamic source” required for rpc.

In general though I think the Qpid python and c++ examples might be better.

Re: RPC Olympics – The Search for the Perfect RPC Protocol

#66

I think it comes to no surprise that sending data through a plain TCP socket is faster than using gRPC. The only downside is that over time requirements will likely start to stack up: - Suddenly you want to enable TLS between one or more components, meaning you need to wrap the socket inside a TLS channel. - You discover that your client behaves poorly when servers go offline, so you add your own logic for keepalives…

In the conclusions the author ends up recommending Redis protocol and the plain TCP conclusion is least attractive of all, so I think you and the article are agreement that plain TCP is not the way to go.

Re: RPC Olympics – The Search for the Perfect RPC Protocol

#68
post #57

Earlier quoted context omitted.

Quick reminder that rebuttals are more valuable than downvotes.

Rebuttals take much longer to write. Assuming that two endpoints are using the same or forward-compatible schemas, there's no "assumption" involved: if you sent a message of type T, it gets decoded as type T. There isn't protection against inauthentic messages, admittedly. Would you like to cite an RPC scheme that meets your definition of type safety.

If you just assume that all the participating programs are correct, then type safety has no meaning. Part of type safety is being able to check, statically or dynamically, that a program isn’t going to interpret a value of type t as an incompatible type T. GRPC has no such facilities. It does not pass around or assert anything about the scheme that was used to encode the message such that the decoder can check safety. Nothing prevents you from sending a wire-compatible EmployeeVacationMessage to the ReactorSelfDestructService.

Re: RPC Olympics – The Search for the Perfect RPC Protocol

#69

Earlier quoted context omitted.

I did see the big warning labels everywhere. However, there is simply no replacement that is equally fast (protocol 5), easy to use (copyreg) and imports necessary modules when deserializing. So tradeoffs were made.

> imports necessary modules when deserializing This is one of the fundamental security issues.

Most of the security issues are mitigated if you are only running the software internally. But it would be interesting to see a hacker who managed to get into the production systems somehow figure out your RPC scheme and try to craft packets to exploit it instead of going directly for the user/password database.

Re: RPC Olympics – The Search for the Perfect RPC Protocol

#70
post #2

Strong 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/

The thin layer on TCP leaves a lot of things to be desired. Such as knowing if the other end has disappeared and won't ever come back.

Last time I used ZeroMQ was ~7 months ago at my previous job, so maybe things have changed since then, but having to write hacks to see if the other side is still there or not is absolutely terrible.

Also, the Python bindings did not like fork() without exec, which yes is bad and all, but is still something that is done every so often in real world large programs.

Post reply on HN