Alfresco JVM Tuning

Alfresco which is a Java based, open source content management system can run on multiple different servers like Tomcat, Websphere etc. But as it internally uses frameworks like Spring it requires JVM. Now whenever we setup Alfresco in production it is very important to setup JVM properly and fine tune JVM parameters in the server to improve its performance.

If you do not setup your JVM properly there are chances you might run out of memory during heavy operations (ex. Uploading large files). You might even see something like this in your logs:

java.lang.OutOfMemoryError <<no stack trace available>>
java.lang.OutOfMemoryError <<no stack trace available>>
Exception in thread “main”

Here we will discuss few important points regarding JVM tuning for Alfresco server.

You should keep the following in mind:

  • Allocated Heap Size
  • PermGen Memory Allocation
  • Memory Swapping Allocation

I find following points very useful

  • -Xmx : max heap size (ex: -Xmx1024)
  • -Xms : min heap size. Having -Xms = 1.8GB (32bit) can be bad, because you don’t let memory for anything else.
  • -Xmn : the size of the heap for the young generation
    Young generation represents all the objects which have a short life of time. Young generation objects are in a specific location into the heap, where the garbage collector will pass often. All new objects are created into the young generation region (called “eden”). When an object survive is still “alive” after more than 2-3 gc cleaning, then it will be swap has an “old generation” : they are “survivor” .
    Good size is 33%
  • -XX:NewRatio : the same as Wmn, but using a % (dynamic fs static -Xmn option). -XX:NewRatio=3 means that the ratio between the old and young generation is 1:3
  • -XX:NewSize – Size of the young generation at JVM init. Calculated automatically if you specify -XX:NewRatio
  • -XX:MaxNewSize – The largest size the young generation can grow to (unlimited if this value is not specified at command line)
  • -XX:SurvivorRatio : “old generation” called tenured generation, ratio, in %. For example, -XX:SurvivorRatio=6 sets the ratio between each survivor space and eden to be 1:6 (eden is where new objects are created)
  • -XX:MinHeapFreeRatio: default is 40%. JVM will allocate memory to always have as minimum 40% of free memory. When -Xmx = -Xms, it’s useless.
  • -XX:MaxHeapFreeRatio: default is 70%. The same as Min, to avoid unnecessary memory allocation.

Courtesy: http://www.avricot.com/blog/?post/2010/05/03/Get-started-with-java-JVM-memory-(heap%2C-stack%2C-xss-xms-xmx-xmn…)

Main thing is allocating proper heap space to JVM instance which your Alfresco server will be utilizing.

Be aware that to avoid memory swapping, -Xmx should never exceed the available RAM in the system. Remember to leave room for memory used by the OS and other applications like OpenOffice via JOD (JOD often uses 1GB of RAM per OO instance).

Once you understand all above parameters and its significance properly you can go to your catalina.bat (in case of tomcat) and setup your JVM_OPTS according your system hardware and alfresco instance requirement.

This post will give you more details on same. JVM Tuning in Alfresco

Looking for quality Alfresco Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , | Posted under Alfresco | RSS 2.0

Author Spotlight

mitpatoliya

I love opensource technologies working with those technologies from the time I have stepped in to the Software Industry. Alfresco CMS is my area of expertise. I have worked on various complex implementations which involved integration of Alfresco with other technologies, extensively worked with JBPM workflows and Webscripts.

Leave a Reply

Your email address will not be published. Required fields are marked *