Overview
Essence RMI was designed with low latency in mind. This page looks at the throughput which can be achieved with a single connection.
Many NIO frameworks focus on scalability for high numbers of connections i.e. 50 to 10,000. Essence RMI focuses on getting high performance from a small number of connections. e.g. for server to server communications.
This investigation was inspired by a look at the throughput which can be achieved using Netty http://www.jboss.org/netty/performance.html
Summary of results.
Essence RMI achieves higher throughput using asynchronous vs synchronous calls, especially where the network latency is non-trivial. Batching achieves dramatically improved throughput for small messages however is not much faster for larger messages (4K+)
Essence RMI achieves around 2x the throughput for synchronous calls on one connection for packets 4K and less than other popular. To achieve the same performance with messaging the number of connections needs to be increased in many cases. In a few cases messaging achieves a higher throughput than Essence RMI with one connection.
Code sample.
The client interface
The client interface defines all the methods which it assumes the server implements.
interface EchoService { public <T> T echo(T object); }
The server implementation
The server should implement all those methods. If the server does not the client gets an UnsupportedOperationException.
class EchoServiceImpl implements EchoService { public <T> T echo(T object) { return object; } }
The asynchronous client interface
By convention a method which has Callback as the type of the last argument is treated as an asynchronous method call.
interface AsyncEchoService extends EchoService { public <T> void echo(T objects, Callback<T> callback); }
Benchmark results.
Message rate on loopback.
| Message size | 128 bytes | 1 Kbyte | 4 Kbyte |
|---|---|---|---|
| Messaging 1 conn. | 16k/s | 16k/s | 13k/s |
| RMI Sync call 1 conn. | 35k/s | 31k/s | 24k/s |
| Messaging 5 conn. | 40k/s | 40k/s | 34k/s |
| Messaging 50 conn. | 49k/s | 63k/s | 48k/s |
| RMI Async call 1 conn. | 101k/s | 83k/s | 39k/s |
| RMI Batching calls 1 conn. | 562k/s | 219k/s | 56k/s |
Message rate over 1 Gb/s local lan.
| Message size | 128 bytes | 1 Kbyte | 4 Kbyte |
|---|---|---|---|
| Messaging 1 conn. | 9k/s | 6.3k/s | 4.6k/s |
| RMI Sync call 1 conn. | 11k/s | 7.8k/s | 5k/s |
| Messaging 5 conn. | 35k/s | 26k/s | 17k/s |
| RMI Async call 1 conn. | 100k/s | 50k/s | 20k/s |
| Messaging 50 conn. | 81k/s | 76k/s | 27k/s |
| RMI Batching calls 1 conn. | 507k/s | 94k/s | 20k/s |
Message rate over 100 Mb/s network.
| Message size | 128 bytes | 1 Kbyte | 4 Kbyte |
|---|---|---|---|
| Messaging 1 conn. | 1k/s | 780/s | 740/s |
| RMI Sync call 1 conn. | 1k/s | 830/s | 560/s |
| Messaging 5 conn. | 5k/s | 4k/s | 2.8k/s |
| RMI Async call 1 conn. | 36k/s | 10k/s | 2.8k/s |
| Messaging 50 conn. | 44k/s | 11k/s | 2.8k/s |
| RMI Batching calls 1 conn. | 86k/s | 6.8k/s | 1.9k/s |