Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the reasons that max jvm heaps are not sized up to or close to the max physical memory on a machine?

I have a 64 bit machine, theoritically the address space is 2^64 bytes and it has 32 G of physical RAM.

this is a server scale machine with 16 cores and is a production server.

Since there is no other process running that consumes mass amounts of memory and the server jvm is the only app thats running, is there any reason to not set the jvm heap to a really large number ?

I am seeing it being set to less than 10 gigs and there is no explanation that I can think of this could be.

As I mentioned earlier in the post: I understand that the kernel, cache and other processes would need to share RAM. But barring any other processes and OS native stuff, there is nothing else going on. this machine is a production machine and solely for this specific jvm.

Would there be any reason to not set to to something like 20 gigs/32 g (physical ram) ?

From the comments below- it appears not...other than the need to fail fast, thanks for your inputs

like image 504
treefrog Avatar asked Dec 06 '13 17:12

treefrog


1 Answers

Because the operating system also needs RAM, for cache, buffers, daemons such as syslogd, page tables, kernel data structures etc.

Also, the JVM designers have no idea what other applications you might want to start after the JVM starts up. So it is sensible for the JVM to not hog all the RAM by default.

like image 197
Robin Green Avatar answered Oct 13 '22 06:10

Robin Green