3 ms·
I don't know serverless, but recently-ish (few months ago) I was testing Java memory usage on a tiny program. Something like: public class Main { p
by quectophoton 4y ago
I don't know serverless, but recently-ish (few months ago) I was testing Java memory usage on a tiny program. Something like:
public class Main {
public static void main(String[] args) throws InterruptedException {
for (int i = 0; i < 60; i++) {
System.out.printf("%d\n", i);
Thread.sleep(1000);
}
}
}
After spamming as many flags as I could find (literally listing all possible flags and seeing what looked like a high number, and lowering it), I could only get this program to use 307MB VIRT and 40MB RES memory.
Unfortunately I didn't save the flags I used.
That's more or less on par with the equivalent Node.js program on my PC (Node.js actually uses a bit more RES memory, 44MB).
So I guess as long as you can (and want to) spam a lot of flags, it's feasible to lower memory usage.
Disclaimer: Not a Java dev.
- lenkite 4y agoIf you really want low memory consumption, you can use Graal native image https://www.graalvm.org/22.0/reference-manual/native-image/ https://www.graalvm.org/22.0/reference-manual/native-image/ If you want a lean, native-compilable microservice framework, there is Quarkus: https://quarkus.io/ https://quarkus.io/
- papruapap 4y agoIn my experience Java performance worse than Node when used with memory cap. I am not an Java expert though, maybe there is a flag I missed.