Wednesday, January 2, 2013

Monitoring Alfresco through JMX

Back in some days we were facing thread locking issue on Alfresco. Got a good chance to enable JMX and see what is happening inside.

How to enable JMX extension with Tomcat (OS Solaris)?
1.Set the property -Dcom.sun.management.jmxremote in alfresco.sh file
JAVA_OPTS=" -server -d64 -Xms10g -Xmx55g -XX:MaxNewSize=10g -XX:MaxPermSize=30g -Dcom.sun.management.jmxremote “ and export JAVA_OPTS
2.Check in file \classes\alfresco\core-services-context.xml bean section “RMIRegistryFactoryBean” should not be commented.
3.For Security purpose change default passwords in below files,
/alfresco/alfresco-jmxrmi.access
/alfresco/alfresco-jmxrmi.password

How to connect JMX client to Remote Alfresco (OS Windows)?
1.Go to your installed Java directory and execute jconsole.exe
D:\cci\javatools\Java\jdk1.6.0_31\bin>jconsole.exe
2.Once jconsole is launched select “Remote Process” radio box and add URL to connect service:jmx:rmi:///jndi/rmi://:50500/alfresco/jmxrmi
3.Input username and password if you have changed. Default username/password is controlRole/change_asap





Once you are connected to remote process you can see below tabs
1.Overview- which shows Heap Memory Usage, Thread, Class and CPU Usages,
2.Memory- Detailed view of Heap Memory and Non Heap Memory Usage,
3.Thread – Detailed of individual threads
4.Classes- Number of Class loaded
5.VM summary- Detailed view of VM summary
6.MBeans- All Mbeans which are exposed either readonly or configurable.

How to user topthread.jar with JConsole?
topthread.jar will allow you to see usage history of threads, CPU usage and state of thread; you can download topthread.jar from here…
1.Go to your installed Java directory and execute jconsole.exe
jconsole.exe -pluginpath D:\cci\javatools\Java\jdk1.6.0_31\lib\topthreads.jar

2.You will be able to see extra tab “Top thread” once jconsole is connected with server.


Top Thread Analysis

Sometimes system becomes unresponsive if any thread got stuck of having more CPU usage even if application seems not to be busy. We can locate such a thread from topthreads and can kill it to get system responsive. We can adjust the refresh interval and max displayed threads to limit our analysis data instead of having much frequent refresh and hundreds of thread being displayed on one small screen.


No comments:

Post a Comment