Did some RPC tests over the wire and got some interesting results. Hope that someone could do something similar and verify.
I run three RPC client/server combination (see links to source code):
- Protobuf as the protocol over a simple TCP/IP client/server java sockets.
- Protobuf as the protocol over a HTTP where the client is using Apache HTTP client (reusing connection), and the server part is a servlet in a War on Jetty v6. The server side (protowar) implementation is very basic and ment only for benchmarking.
- Spring RPC, the war container is Jetty v6. Not posting the source code for this one, but its basically the same as in the protobuf example, using java serialization and spring.
- protobuf on plain socket: 0.228 milli/roundtrip
- protobuf on HTTP: 2.08 milli/roundtrip
- Spring/RPC: 106.8 milli/roundtrip
I.e. you loose over an order of magnitude by using HTTP. But say you would like to keep it around and use the benefits of web containers, HTTP VIPs etc, then a milli (less on a real server) might be worth it. But jumping to Spring/RPC, that will cost you. Sure, you have tons of benefits there, just make sure you know the tradeof.