Understanding java Memory settings
As part of the Best Practices, we know that we should be setting -Xms & -Xmx Java command line parameters. What are these settings and why is it required to set these.
As JAVA starts, it creates within the systems memory a Java Virtual Machine (JVM). JVM is where the complete processing of any Java program takes place. All JAVA applications (including IQv6) by default allocates & reserves up to 64 MB of memory resource pool from the system on which it is running.
The Xms is the initial / minimum Java memory (heap) size within the JVM. Setting the initial memory (heap) size higher can help in a couple of ways. First, it will allow garbage collection (GC) to work less which is more efficient. The higher initial memory value will cause the size of the memory (heap) not to have to grow as fast as a lower initial memory (heap) size, thereby saving the overhead of the Java VM asking the OS for more memory.
The Xmx is the maximum Java memory (heap) size within the Java Virtual Memory (JVM). As the JVM gets closer to fully utilizing the initial memory, it checks the Xmx settings to find out if it can draw more memory from the system resources. If can, it does so. For the JVM to allocate contiguous memory to itself is a very expensive operation. So as the JVM gets closer to the initial memory, the JVM will use aggressive garbage collection (to clean the memory and if possible avoid memory allocation), increasing the load on the system.
If JVM is in need of memory beyond the value set in Xmx, the JVM will not be able to draw more memory from system resource (even if available) and run out of memory. Hence, the -Xms and -Xmx memory parameters should be increased depending upon the demand estimation of the system. Ideally both same should be the same value (set at maximum possible as per demand estimation). This ensure that the maximum memory is allocated right at the start-up eliminating the need for extra memory allocation during program execution. We recommend aggressive maximum memory (heap) size of between 1/2 and 3/4 of physical memory.
NOTE:-
When determining the maximum memory (heap) size you want to set be sure to take into account other software running on the machine.
When Internal database (HSQL) is used, the database server and IQuinox share the same Java environment. In this case, allocate JAVA as much as memory as possible (at least upto 75% of system memory) . e.g. if system memory = 256 MB, in the ng.bat / iq.bat set -Xms192m -Xmx192m in the java command.
When External database (MySQL) is used, only IQuinox uses the Java environment. In this case, allocate JAVA only upto 50% of system memory. e.g. if system memory = 256 MB, in the ng.bat / iq.bat set -Xms128m -Xmx128m in the java command.Steps to change -Xms & -Xmx settings:
Shut down IQv6.
Go to "...\Program Files\QLC".
Locate the file "ng.bat" here and open it in any Text Editor.
Locate the line "start shared\jre1.5\bin\javaw -Xms128m -Xmx128m .....".
Change it to "start shared\jre1.5\bin\javaw -Xms256m -Xmx256m .....".
Save the file and close it .
Start IQuinox and verify its correct functioning!!!
As JAVA starts, it creates within the systems memory a Java Virtual Machine (JVM). JVM is where the complete processing of any Java program takes place. All JAVA applications (including IQv6) by default allocates & reserves up to 64 MB of memory resource pool from the system on which it is running.
The Xms is the initial / minimum Java memory (heap) size within the JVM. Setting the initial memory (heap) size higher can help in a couple of ways. First, it will allow garbage collection (GC) to work less which is more efficient. The higher initial memory value will cause the size of the memory (heap) not to have to grow as fast as a lower initial memory (heap) size, thereby saving the overhead of the Java VM asking the OS for more memory.
The Xmx is the maximum Java memory (heap) size within the Java Virtual Memory (JVM). As the JVM gets closer to fully utilizing the initial memory, it checks the Xmx settings to find out if it can draw more memory from the system resources. If can, it does so. For the JVM to allocate contiguous memory to itself is a very expensive operation. So as the JVM gets closer to the initial memory, the JVM will use aggressive garbage collection (to clean the memory and if possible avoid memory allocation), increasing the load on the system.
If JVM is in need of memory beyond the value set in Xmx, the JVM will not be able to draw more memory from system resource (even if available) and run out of memory. Hence, the -Xms and -Xmx memory parameters should be increased depending upon the demand estimation of the system. Ideally both same should be the same value (set at maximum possible as per demand estimation). This ensure that the maximum memory is allocated right at the start-up eliminating the need for extra memory allocation during program execution. We recommend aggressive maximum memory (heap) size of between 1/2 and 3/4 of physical memory.
NOTE:-
When determining the maximum memory (heap) size you want to set be sure to take into account other software running on the machine.
When Internal database (HSQL) is used, the database server and IQuinox share the same Java environment. In this case, allocate JAVA as much as memory as possible (at least upto 75% of system memory) . e.g. if system memory = 256 MB, in the ng.bat / iq.bat set -Xms192m -Xmx192m in the java command.
When External database (MySQL) is used, only IQuinox uses the Java environment. In this case, allocate JAVA only upto 50% of system memory. e.g. if system memory = 256 MB, in the ng.bat / iq.bat set -Xms128m -Xmx128m in the java command.Steps to change -Xms & -Xmx settings:
Shut down IQv6.
Go to "...\Program Files\QLC".
Locate the file "ng.bat" here and open it in any Text Editor.
Locate the line "start shared\jre1.5\bin\javaw -Xms128m -Xmx128m .....".
Change it to "start shared\jre1.5\bin\javaw -Xms256m -Xmx256m .....".
Save the file and close it .
Start IQuinox and verify its correct functioning!!!
Comments
Post a Comment