Back

Why low-latency Java still requires discipline?

30 points2 hourschronicle.software
motoboi46 minutes ago

I found claude and GPT very helpful on this, because java have a very sofisticated monitoring harness. Just ask the agent to connect to the running application (on kubernetes or whatever) on prod and do a java flight recording then analyze allocations.

I managed to improve some applications of ours from several garbage collections per second to several minutes between collections. That _really_ improves p99.

declan_roberts7 minutes ago

That sounds like a great idea. What kind of prompt do you use?

wmichelin29 minutes ago

[dead]

chuckadams41 minutes ago

I get that blog posts often advertise a company's products, but this one had absolutely zero content other than advertising.

pjmlp9 minutes ago

Even C requires discipline to write low latency code, if you think otherwise, you never used a profiler.

dominicrose1 hour ago

page doesn't load "En attente de la réponse de chronicle.software."

PaulHoule57 minutes ago

+ low latency anything requires discipline. if you lose 5ms you can't get it back.

opentokix23 minutes ago

How about not using Java? Then you can have low latency.

Average go, rust, c++ and c will outperform amazing java programs, and the former will also be way way more easy to run, troubleshoot, interpret logs from.

Java is usch garbage in every stack.

SeanLuke8 minutes ago

I need a UI which runs well on Windows, MacOS, and Linux, without having to build three different ones. Swing is still easily the best, most consistent, and most native-feeling cross-platform environment. It's much better than QT and GTK in most respects. And Java also runs elegantly on a little platform you may know as Android. I have high hopes for go and rust. But until they have mature UIs, they're out (for me).

C and C++ are dangerous languages filled with security failings and footguns, and no modern app should be written in them.

It's been my experience that well-written low-level Java code runs at about 75% the speed of good C code. (Of course lazy coders write in cushy Java which is much slower). When written efficiently, Java's biggest slowdown lies in array access (C and C++ array access is fast because it is very, very unsafe). But Java makes up for this in having a GC which will coalesce related objects into the same page and so take advantage of cache coherency effects in ways malloc and free cannot possibly do. I have some allocation-heavy algorithms in Java which are, as a result, significantly faster than well-written equivalents in C.

pjmlp9 minutes ago

It is a matter of skill.

motoboi15 minutes ago

Rust? OK.

C++ or go? Then you'll have to take a very closer look, because the java JIT is wonderful. A masterpiece of several hands, actually.

cavoirom16 minutes ago

yes, until you need debugging.