August 19, 2017

Alfresco, JVM tuning and monitoring with JMX

Tuning and deeper inspection of the Java Virtual Machine is a very important activity for java-based applications. In an enterprise-class installation of Alfresco where often one or multiple clustered instances are running, a huge amounts of data are stored with a lot of user access that cause often a http overload. Like many other Java applications, Alfresco can be optimized by a careful and meticulous tuning of the hardware resources, specifically cpu and ram used by the JVM. I am not versed in the details regarding java thread management, you can found further details here. To make a succesfull JVM tuning, the Alfresco official wiki suggests the following approach.

1. Throw as much RAM as possible at the JVM (-Xmx32G);
2. Set the perm gen to 256M (-XX:MaxPermSize:256m);
3. Don’t add any other configuration settings.

Once the heap memory has the maximum allowed value, you can proceed with additional configuration parameters by editing the JAVA_OPTS variable which is located in the Alfresco startup script.Here the JAVA_OPTS settings in a default Alfresco installation.

In a recent documentation, Alfresco has released a table of possible values ​​for the heap memory based on the number of users accessing the system.

 jvm-tuning-00

Note that for these metrics, N concurrent users is considered equivalent to 10xN casual users that the server could support. Follow a best practice for an Alfresco installation where about 5 milions of documents are stored and  frequently solr searches are performed.

– Guest Alfresco = 4.0.0 Enterprise (2 cluster nodes)
– Guest RAM = 10 GB
– Guest CPU = 4 virtual cores
– Hypervisor = Esxi 5.0
– Host CPU = Intel Xeon E5640 2.67GHz
– Storage = 1 TB SAN (via NFS)

Now, let’s see how to perform a deep monitoring of the JVM.

Case 1. Using jstad and jvisualvm client.

– Server JVM

 

– Client JVM

 jvm-tuning-01

Case 2. Using JMX and jvisualvm client (Alfresco Enterprise 3.2 and higher).

– Server JVM

By default the JMX interface allows you to access Alfresco Enterprise via a standard JMX console that supports JMX Remoting like jvisualvm. There are no more settings to do for Alfresco server. Only a important note for Redhat/Centos operative systems: Alfresco has an in process RMI registry that will be started on the IP specificed by the command line property -Djava.rmi.server.hostname and the port in alfresco.rmi.services.host. If you have multiple network interfaces, you must start Alfresco defining the “java.rmi.server.hostname” with the server IP address. A second solution is to add a new local dns entry in the /etc/hosts file.

 

– Client JVM

Run jvisualvm and attach a JMX connection using the default Alfresco credentials.

 jvm-tuning-03

 

Related posts

Leave a Reply

Your email address will not be published.