fbpx

What are the main challenges when using Java for low latency work?

(Last Updated On: August 19, 2011)

What are the main challenges when using Java for low latency work?
—-
one: it is non deterministic. What you see once in development is not likely to be seen again in production. A scattergram of response times is all over the map.
4 days ago
—-
Not sure about challenges part, but Real Time Java promises deterministic execution of code based on hard real time operating systems. That’s what I’ve read in a book.
—-

Yes, it’s true – there is real time Java, but it is soft real-time (OK for HFT) and has a little drawback – while minimizing dispersion of latency it does increase average of it.
—–
Real time Java is not regular Java. It is not, “write once run everywhere” any more.

Yes the OS has to participate in the solution by doing what it is told and not “helping” you when you do not expect it.

The various RT Javas were not consistent.
—-
The lack of “write-once, run-anywhere” with RT Java Spec isn’t a big deal, in my opinion.
If you’re investing the effort to write real-time Java code (which has some significant differences from non-real-time) you aren’t going to be switching JVMs very often, nor are you going to be running inside a browser (where WO-RA matters most).

The biggest challenge with writing low-latency Java is that you usually can’t use much, if any, of the standard libraries, particularly the containers. You end up having to rewrite these yourself to optimize them for your particular applications.

The unfortunate truth is that although Java is a fairly nice multi-threaded language, you can’t take advantage of it if you need consistently low-latency performance.

I’d say that if you’re being realistic about planning a new development project, you should assume that writing the code in Java will take about as long as writing in C++ would take (assuming your developers are good enough to write high-performance Java code). If they do a good job, the result should be about as fast as C++ code would be, plus or minus 10-20%, depending on the application and programmer skill.
—-
I understand it not being a big deal once you pick an environment to use. The point I was trying to make is that it turns out to be a different Java on each platform, so you have to really know the target well. Switching is not an easy option if you become disallusioned with your first choice.

Plus once you start programming with the quirks of RT Java you mighty as well be using C++ which is portable.
—–
To name just a few: the hotspot compiler takes a while to optimize your code. You don’t have good control over which thread runs on which cpu. Its 2-3 slower than comparable C.

Don’t use the real-time java. Its deterministic but slow.

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Subscribe For Latest Updates

Sign up to best of business news, informed analysis and opinions on what matters to you.
Invalid email address
We promise not to spam you. You can unsubscribe at any time.

NOTE!

Check NEW site on stock forex and ETF analysis and automation

Scroll to Top