-
Type:
New Feature
-
Status: Closed
-
Priority:
Minor
-
Resolution: Duplicate
-
Affects Version/s: 5.1.1
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
It would be great if the Ehcache JMX beans were exposed, so that we could use tools like VisualVM to look at the Ehcache configuration used by Liferay, and most importantly, to see the Ehcache statistics.
This will make it a lot easier to see where cache misses are occuring, and see how configuration files should be edited.
You can read an article about how I patched Liferay 5 slightly to expose the Ehcache JMX cache beans at : http://www.kanonbra.com/index.php/projects/performance-testing/18-using-visualvm-on-liferay
If Liferay is upgraded to use ehcache version 1.5, it is easier to expose the JMX beans, as mentioned here : http://ehcache.sourceforge.net/javadoc/net/sf/ehcache/management/ManagementService.html
Then we could just have a config setting in Liferay, and depending on that value, the Liferay could could register the Ehcache beans.
If you choose to not upgrade the Ehcache version, you could solve this enhancement request by changing the code similair to what I did :
Change com.liferay.portal.cache.EhcachePortalCacheManager class :
Add
import javax.management.MBeanServer;
import java.lang.management.ManagementFactory;
import net.sf.ehcache.management.ManagementService;
and change the "afterPropertiesSet" method to look like this, by adding the last three lines :
public void afterPropertiesSet()
{ URL url = getClass().getResource(PropsUtil.get(_configPropertyKey)); _cacheManager = new CacheManager(url); // Register Ehcache JMX beans MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); ManagementService.registerMBeans(_cacheManager, mBeanServer, true, true, true, true); }