Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can JVM use more than 4gb of memory

I have a request to install a Linux server (preferably Ubuntu 64bit server), and Java (64 bit) on the following machine:

  • Intel Core2Quad Q8200 - 2.33 GHz
  • 8gb DDR2 ram
  • 2x 320GB SATA HDD in soft RAID1 mirror (mirror)

The problem is how to configure system and Java because I need JVM to use more than 4gb of memory.

It cannot be distributed on many virtual machines. There is data more than 4GB large and it has to be in memory because HDD is slow and performance is critical.

This is a configuration and performance question and I am interested in comments if anyone has experience?

thank you very much for helping me on this...

like image 507
reg Avatar asked Jun 29 '10 18:06

reg


2 Answers

A 64 bit JVM should have no problem at all with giant heaps, certainly much larger than your available RAM. Just increase the heap size when you start the JVM, for example:

java -Xmx6g

You used to have to specify the 64bit flag (with -d64), but I don't think this is necessary any more.

32bit JVMs can manage something like 3GB of heap.

like image 88
skaffman Avatar answered Oct 20 '22 12:10

skaffman


skaffman's answer which provides the required flag for allocating 6GB of memory is correct. If the 'g' does not do the trick you might want to try 6000m (check the link below for details on flags/platform)

For other options you can find useful information on all available options for the Java HotSpot VM here.

http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp

(Behavioral and performance options are available. Platform specific links also available on this page)

like image 44
Andreas Avatar answered Oct 20 '22 13:10

Andreas