Appboard/old/memory configuration: Difference between revisions

imported>Mike.berman
(add note about upgrades)
imported>Jason.nicholls
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:Memory Configuration}}
[[Category:AppBoard old]]
This page details some settings that the AppBoard system administrator can modify to allocate the proper amount of server memory to AppBoard.
This page details some settings that the AppBoard system administrator can modify to allocate the proper amount of server memory to AppBoard.




== Allocating Additional Memory ==
== Memory Tuning ==




{{Tip|If your system is experiencing lags or performance issues, or you see the error message "Out of heap space", you may want to allocate additional memory to the Java Virtual Machine.}}
{{Tip|If your system is experiencing lag or performance issues, or you see the error message "Out of heap space", you may want to allocate additional memory to the Java Virtual Machine.}}




The heap size is the amount of Java object storage memory the Java Virtual Machine (JVM) is allowed to allocate. In the case of most JVMs, the default setting of the maximum heap size is 64MB. You can increase the maximum heap size of applications by setting the -Xmx JVM parameter. For example -Xmx1024m allows maximum 1GB (1024MB) heap to be allocated for the JVM. It is recommended to specify a considerably lower value than the total amount of physical RAM on the server, so the operating system and other applications will also have enough space. Otherwise, the swap memory of the operating system will be used, which can result in high disk activity, and reduced system performance.
The heap size is the amount of Java object storage memory the Java Virtual Machine (JVM) is allowed to allocate. By default enPortal / AppBoard size the maximum heap size (-Xmx) option to work on a system with 2GB minimum physical RAM. Please refer to the [[appboard/old/runtime_options|Runtime Options]] page for the current default settings and where to make changes to these values.


== Tuning JAVA_MEMORY_MAX (-Xmx) ==


Perform the following steps to review the memory heap size settings for AppBoard:
For a server dedicated to running enPortal / AppBoard allocate as much available physical memory as possible. It's important to avoid allocating too much memory however, as this may lead to the OS using swap memory (i.e. disk) further degrading system performance. Factor in memory the OS is using itself, other applications on the system, and the <tt>JAVA_PERM_SIZE_MAX</tt> setting too.
# Go to [AppBoard_Home]/server/bin/setenv.bat (or setenv.sh on Unix).
# Open the file in a text editor. You will see lines similar to the following:
<code>[xml,N]set JAVA_MEMORY_MAX=1536
rem set JAVA_MEMORY_MAX=2048</code>


The limit for 32-bit operating systems is less than the 4096 MB of theoretical address space. For Windows, the real limit is under 1600 MB (due to memory used for non-heap storage and Windows limitation of user space addressable memory to under 2048 MB), which is why the default is 1536 MB (512 MB x 3). If AppBoard is running on both a 64-bit operating system and a 64-bit Java, it can support a higher setting for the heap size. For example, you can increase the memory available to Tomcat from 1536 MB to 2048 MB by activating the second setting, as follows:
On 32-bit operating systems there is a theoretical limit of 4GB but in practice it depends. On 32-bit Windows systems the max -Xmx setting that will work is around 1.6GB. On 32-bit Linux systems it's closer to 3GB.


<code>[xml,N]rem set JAVA_MEMORY_MAX=1536
== Tuning JAVA_PERM_SIZE_MAX (-XX:MaxPermSize) ==
set JAVA_MEMORY_MAX=2048</code>
 
Depending on the RAM on your AppBoard server, higher values for the maximum heap space will typically provide better performance overall. However, for complete system optimization, the efficiency of your system with regard to data retrieval, caching, querying, etc., must be considered and will often be the limiting factors for performance.
 
 
{{Note|You should make any changes to the memory settings in <tt>setenv-custom.bat</tt>.  This will ensure that these setting will be preserved when you upgrade the system.}}


Memory reserved for permanent generation is in addition to the <tt>-Xmx</tt> value configured above. If there are <tt>java.lang.OutOfMemoryError:
PermGen space</tt> errors in the logs then it is necessary to increase this value.


== Monitoring Garbage Collection ==
== Monitoring Garbage Collection ==


If you are experiencing a memory leak, and would like to carefully report on each garbage collection event, you can log this data to a file by using the <tt>-Xloggc:file</tt> Java Option. Each reported event will be preceeded by the time (in seconds) since the first garbage-collection event.
Monitoring the JVM garbage collection events can provide insight into how AppBoard is utilizing the memory available to it and help to diagnose performance issues and out of memory issues.
 
Always use a local file system for storage of this file to avoid stalling the JVM due to network latency.
 
Perform the following steps to enable memory logging for AppBoard to a file:
# Go to [AppBoard_Home]/server/bin/setenv.bat (or setenv.sh on Unix).
# Open the file in a text editor. You will see a line near the bottom of the file similar to the following:
#: <code>[xml,N]set JAVA_OPTS=-Xmx%JAVA_MEMORY_MAX%m ... -Dkeystore.pass=%KEYSTORE_PASS%</code>
# Add the Xlogcc parameter, such as in the following example:
#: <code>[xml,N]set JAVA_OPTS=-Xmx%JAVA_MEMORY_MAX%m ... -Dkeystore.pass=%KEYSTORE_PASS% -Xloggc:c:\GCout.txt</code>


To enable GC logging use the <tt>JAVA_GC_LOGGING</tt> runtime option which will generate a <tt>gc.log</tt> log file in the AppBoard logs directory. Enabling GC logging is not resource intensive and does not create a huge log - it is '''safe for production use'''. The AppBoard server must be restarted after changing this option.


{{Note|Changes to the memory logging settings as described above must be manually preserved on upgrade, since the upgraded system will overwrite the setenv file and revert to the standard JAVA_OPTS settings.}}
Analysing the gc.log file produced is possible with a number of tools such as [https://github.com/chewiebug/GCViewer GCViewer], or Edge Support may be able to provide assistance by sending us the <tt>gc.log</tt> for analysis.

Latest revision as of 11:28, 17 July 2014

This page details some settings that the AppBoard system administrator can modify to allocate the proper amount of server memory to AppBoard.


Memory Tuning

Template-tip.png
If your system is experiencing lag or performance issues, or you see the error message "Out of heap space", you may want to allocate additional memory to the Java Virtual Machine.


The heap size is the amount of Java object storage memory the Java Virtual Machine (JVM) is allowed to allocate. By default enPortal / AppBoard size the maximum heap size (-Xmx) option to work on a system with 2GB minimum physical RAM. Please refer to the Runtime Options page for the current default settings and where to make changes to these values.

Tuning JAVA_MEMORY_MAX (-Xmx)

For a server dedicated to running enPortal / AppBoard allocate as much available physical memory as possible. It's important to avoid allocating too much memory however, as this may lead to the OS using swap memory (i.e. disk) further degrading system performance. Factor in memory the OS is using itself, other applications on the system, and the JAVA_PERM_SIZE_MAX setting too.

On 32-bit operating systems there is a theoretical limit of 4GB but in practice it depends. On 32-bit Windows systems the max -Xmx setting that will work is around 1.6GB. On 32-bit Linux systems it's closer to 3GB.

Tuning JAVA_PERM_SIZE_MAX (-XX:MaxPermSize)

Memory reserved for permanent generation is in addition to the -Xmx value configured above. If there are java.lang.OutOfMemoryError: PermGen space errors in the logs then it is necessary to increase this value.

Monitoring Garbage Collection

Monitoring the JVM garbage collection events can provide insight into how AppBoard is utilizing the memory available to it and help to diagnose performance issues and out of memory issues.

To enable GC logging use the JAVA_GC_LOGGING runtime option which will generate a gc.log log file in the AppBoard logs directory. Enabling GC logging is not resource intensive and does not create a huge log - it is safe for production use. The AppBoard server must be restarted after changing this option.

Analysing the gc.log file produced is possible with a number of tools such as GCViewer, or Edge Support may be able to provide assistance by sending us the gc.log for analysis.