You may find that you do not need reliable messaging for all types of messages. For example, if you repeatedly send the status of things like players, and several packages are lost, it may not even matter.
There are reliable, high-performance, UDP-based libraries that support Java. One of them is 29West LBM. It is not cheaper because it is very difficult. Even with a professional product, you may need a dedicated UDP network to minimize losses.
For the purposes of the game, I suggest you use a JMS service, such as ActiveMQ, which works wherever you can run Java. You should be able to send 10 thousand messages per second with a delay of several milliseconds.
When people say that something should be as fast as possible, it can mean anything. For some, this means 10 ms, 1 ms, 100 ms, 10 ms, 1 m. Some network routers support packet transmission with a delay of 600 ns. The lower the latency, the higher the cost and the greater the impact on the design. Assuming you need more speed than you need, this can affect the design and costs unnecessarily.
You must be realistic, seeing that you have a human interface. A person cannot respond faster than about 1/20 second or about 50 ms. If you keep messaging for less than 5 ms, the person will not be able to tell the difference.
source share