3 ms·
It's hard to say without really diving into that code. The 100x disparity seems pretty surprisingly high. Often times people will give the JVM a sizeable heap
by switchbak 9y ago
It's hard to say without really diving into that code. The 100x disparity seems pretty surprisingly high.
Often times people will give the JVM a sizeable heap in the interests of reducing garbage collector pressure (sometimes this is counterproductive). Usually it's possible to run with a much smaller heap, but we're still talking 100's of megabytes for most non-trivial apps. Even the VM itself will allocate a decent amount of memory besides that.
There's a number of reasons that typical JVM apps use more memory, but most of it seems to boil down to using the heap much more, lack of real value types (using the stack far less), and size overhead with small objects (see: https://www.javamex.com/tutorials/memory/object_memory_usage.shtml https://www.javamex.com/tutorials/memory/object_memory_usage...).
It seems like the low cost cloud instances could be a real driver for the adoption of more lean runtimes. My client couldn't even consider those 256m/512m Heroku instances (with a large legacy JVM app).