
For a couple of months, I was wondering if Java would be suitable to provide relay services, in case of a Java Jingle Client wanted to enable it.
Of course Java is perfectly suitable for using a Relay Service, no doubt about the trivial statement. But is Java suitable to be used on providing it?
Researching on Internet I found nothing but rumors and assumptions. So I decided to try it myself. I agreed with a Jingle Node Project Contributor to provide a Java Relay Channel Class just like we have the C++ version using Boost. And I would provide the UnitTest Cases in order to measure added latency. This weekend with the code in our hands we ran the tests.
All the tests were conducted using loopback interface in order to prevent real network to influence in the results.
Results running 10 simultaneous channels processing and relaying 30 packets, the overall average values after 100 tests, for Latency was:
- Max: 52ms
- Min: 7ms
- Avg: 10.0ms
Surprisingly the results are very satisfactory for Client Side Relaying. And I have to admit that the Java Code is by far more elegant and simple.
This means that
SIP Communicator is not only a good candidate for Jingle Nodes usage, but also a great candidate to also provide Jingle Nodes relaying features.
For comparison criteria I created an extra test case based on a single Relay Channel using a C++ and a Java Channel measuring the added latency by using a Relay, instead of direct traffic. The results were the following:
C++/Boost-ASIO Latency:
Max: 16ms, Min: 2ms, Avg: 3.0ms
Java NIO Latency:
Max: 90ms, Min: 2ms, Avg: 5.0ms
I strongly encourage Java and C++ Developers to do a try out and spicy the discussion.