3 ms·
I should elaborate a bit on RPC issues: RPC is somewhat of a misnomer, it's a fallacy ("fallacy of distributed computing") to think that a remote method call is
by strlen 13y ago
I should elaborate a bit on RPC issues: RPC is somewhat of a misnomer, it's a fallacy ("fallacy of distributed computing") to think that a remote method call is the exact same thing as a local method call (anyone who has built a serious system using Java RMI or Spring RPC -- which hacked InvocationContext/used AOP to intercept local method calls and turned them into remote calls -- can confirm this).
Instead successful RPC wrappers tend to follow two patterns:
1) Thin client, with heavy lifting done on a server side proxy written in the same language as the original client. This is the pattern we followed with Voldemort when I was at LinkedIn -- there was a heavy Java RPC client (which had a lot of client logic) and thin clients that (like parts of the Java client) used protobuf over the wire, but contained much less logic.
Problem with this is that it adds an extra hop (latency issue) and at times interface mis-match viz. local clients.
2) Only expose the protocol via the RPC, write a first-class implementation (given the full blown protocol) in major languages. Practically this means native "fat" client (whether in Java or C++) uses the full RPC wire protocol (but may use a higher performance server implementation) and works in the case where major languages are Java (or JVM-based) and C/C++: Python/Ruby/PHP/etc... use Swig or custom extensions to use the C++ client, Java has its own native client built in parallel. If you add another language without FFI to either Java or C/C++ to the mix (or there's significant velocity mismatch between team working on the Java-based vs. C++ based clients/server) maintenance becomes an issue.
This is an approach I was following on my last project at FB with HBase (I've since left FB and am elsewhere, but the work is continuing and will likely be open sourced) for another distributed system -- where the proxy Thrift service always lagged behind the native client and where most heavy C/C++ based clients built their own thrift proxies to talk to HBase. Upstream HBase (and HDFS) -- FB has its own (open sourced) branch -- has also followed a similar approach with converting the native protocol to use protocol buffers for SerDe.
- kentonv 13y agoI agree that RPC is not equivalent to a local call. However, it's still worthwhile to create an API where making an RPC is as easy as possible, probably by making it look very much like a local call, as Cap'n Proto aims to do. Note that Cap'n Proto's RPC will support promise pipelining. This means that if one RPC returns a pointer to another interface, you can start making RPCs to the returned interface before the first RPC has actually returned. Basically you're saying to the server "When you finish this RPC, invoke this method on its result.". The hope is that this will make it possible to avoid a lot of round trips even when using a call-return-style interface, thus making it reasonably possible for clients to use the Cap'n Proto interface definition directly without the help of a fat client library. And that, in turn, gives you freedom to use any language that has Cap'n Proto bindings, rather than the specific languages the server chose to support.