Hacker News new | ask | show | jobs
by lmm 1281 days ago
I took just the opposite lesson from this: the JVM offers enough turing knobs that in the rare, extreme cases where the defaults don't work for you (I suspect few single-server workloads in the world have the combination of complexity and request rate that Lichess does), there are still ways to do something about it. If he'd been using, say, Go, he'd probably have had to give up and roll back, or patch the runtime code.
3 comments

I’ve been using Go for 7’ish years across a large codebase, comprising multiple services interacting with millions of people.

Every release Go gets better and requires 0 changes to the code. I have never needed to fine-tune the GC. I have never needed to spend a month rewriting my code to work with Go 2.0. I have never been nervous to update to a new Go version. I write the code once, and it runs great in prod for years. I love and value these things. I also suspect that Lichess’s use case would perform extremely well in Go out-of-the-box, since it’s just a web app.

I certainly hope the JVM team would like Lichess and other web apps to run well without needing arcane configuration knowledge gathered over years of experience and battle scars in production.

> I’ve been using Go for 7’ish years across a large codebase, comprising multiple services interacting with millions of people.

> Every release Go gets better and requires 0 changes to the code. I have never needed to fine-tune the GC. I have never been nervous to update to a new Go version.

I've had the same experience with the JVM, over a longer time period. You hear about this because it's exceptional and interesting, not because it's the norm. "Just a web app" is an incredibly reductive take.

The same problem exists in the Go runtime (it's fundamental to the problem space), and since they don't let you tune it presumably they either guess or hardcode what the value should be; good luck if they get it wrong. Sure, you probably won't hit it with your code - the overwhelming majority of Java users don't hit this kind of problem with their code either.

The JVM is a runtime virtual machine. Go produces static binaries (I think?) that run on the CPU, big difference.
Go produces binaries but those include a substantial runtime, with e.g. garbage collection and full reflection.
They're not tuning the GC, really. They're tuning the code cache. That's what the main culprit was. Go doesn't have a JIT. No code cache to configure.
> or patch the runtime code

A huge spike in CPU usage would be treated as a regression in other language runtimes and would likely be addressed. The fact that this is solvable with advanced JVM knobs is both good and bad. Good in the way you say. Bad because the complexity of maintaining all those knobs makes it difficult if not impossible to improve the runtime defaults, and every runtime problem becomes a tuning problem.

> A huge spike in CPU usage would be treated as a regression in other language runtimes and would likely be addressed.

A spike that applied to all programs certainly would. A spike that applied to only one program? Good luck, IME.

"If he'd been using, say, Go, he'd probably have had to give up and roll back, or patch the runtime code."

Err no, Go has GC yes, but most of that tuning seems to be related to JIT/Codepaths etc.