The fastest way to communicate between JVMs on the same computer is to use shared memory, for example. through memory mapped files. This is 100 times faster than using Socket over loopback. for example, 200 ns round-trip time versus 10-20 microsecond transit times for sockets.
One implementation of the Java Chronicle BTW 100 ns latency includes message persistence.
If you need any of these solutions, you should not take it for granted. Often, when people say that they should have the “fastest”, they really mean that they don’t know how fast it should be so if they choose the fastest, it should be the right decision. This is usually not the case, because making the fastest decision often means that the trade-offs in design and implementation that it can turn are never needed, unless you knew what the requirements really were.
In short, if you don't have specific measurable latency and / or bandwidth requirements, you should assume that the simplest solution is what you really want. It can be replaced with something faster if it turns out that it is not suitable when you better understand what is required.
source share