Remix.run Logo
userbinator 4 days ago

Under no/low memory contention

on some workloads this may represent a non-trivial drop in performance due to stale, anonymous pages taking space away from more important use

WTF?

creshal 4 days ago | parent [-]

Welcome to the wonderful world of Java programs. When your tomcat abomination pulls in 500 dependencies for one method call each, and 80% of the methods aren't even called in regular use except to perform dependency injection mumbo jumbo during the 90 seconds your tomcat needs to start up, you easily end up with 70% of your application's anon pages being completely useless, but if you can't banish them to swap, they'll prevent the code on the hot path from having any memory left over for file caching.

So even if you never run into OOM situations, adding a couple gigabytes of swap lets you free up that many gigabytes of RAM for file caching, and suddenly your application is on average 5x faster - but takes 3 seconds longer to service that one obscure API call that needs to dig all those pages back up. YMMV if you prefer consistently poor performance over inconsistent but usually much better performance.

marginalia_nu 4 days ago | parent [-]

Java's performance for cold code is bad period. This doesn't really have to do with code being paged out (that very rarely happens) but due to the JIT compiler not having warmed up the appropriate execution paths so that it runs in interpreted mode, often made worse as static object initialization happening when the first code that needs that particular class runs, and if you're unlucky with how the system was designed that may introduce cascading class initialization.

Though any halfway competent Java developer following modern best practices will know to build systems that don't have these characteristics.

creshal 3 days ago | parent [-]

> Though any halfway competent Java developer following modern best practices will know to build systems that don't have these characteristics.

I'll let you know if I ever meet any. Until then, another terabyte of RAM for tomcat.

marginalia_nu 3 days ago | parent [-]

Java generally performs much better when it isn't given huge amounts of memory to work with.