Fórumok

Disable Blocking Portal Cache

Sathya E, módosítva 9 év-val korábban

Disable Blocking Portal Cache

New Member Bejegyzések: 22 Csatlakozás dátuma: 2009.03.31. Legújabb bejegyzések
What is the impact of disabling the BlockingPortalCache ?

There are thread stuck issues encountered in our application (LR 6.1.0). Stack traces of blocked/wait threads shows BlockingPortalCache.get method.

We are planning to disable the BlockingPortalCache to avoid the threads getting blocked.

#For finder Cache
value.object.finder.blocking.cache=false
thumbnail
Andew Jardine, módosítva 9 év-val korábban

RE: Disable Blocking Portal Cache

Liferay Legend Bejegyzések: 2416 Csatlakozás dátuma: 2010.12.22. Legújabb bejegyzések
The comment in the portal.properties for that value references another property for more information. Based on the commentary for the other property it looks like there is a higher level setting that provides two options (depending on how you set it).

1. Lock the entire cache when it is being used

2. Lock just the object being accessed.

Here is the other property it refers to.


    #
    # Set this to true to allow Ehcache to use blocking caches. This improves
    # performance significantly by locking on keys instead of the entire cache.
    # The drawback is that threads can hang if the cache is not used properly.
    # Make sure that all queries that return a miss also immediately populate
    # the cache, or else other threads that are blocked on a query of that same
    # key will continue to hang. Reference Ehcache's BlockingCache for more
    # information. The blocking cache is no longer implemented by Ehcache's
    # BlockingCache, but by Liferay's BlockingPortalCache for better safety and
    # faster performance.
    #
    # Blocking cache together with transactional cache performs poorly, because
    # transactional cache affects the cache population visibility across
    # transactions. When transactional cache is on, blocking cache most likely
    # does nothing useful unless the transaction window time is short. When
    # transactional cache is off, it is better to turn on blocking cache for
    # better database access performance.
    #
    ehcache.blocking.cache.allowed=false


If you want to see the actual usage reference, assuming you are using ehcache, check out the com.liferay.portal.cache.ehcache.EhcachePortalCacheMananger class; specifically the getCache method


	@Override
	public PortalCache<k, v> getCache(String name, boolean blocking) {
		PortalCache<k, v> portalCache = _portalCaches.get(name);

		if (portalCache == null) {
			synchronized (_cacheManager) {
				portalCache = _portalCaches.get(name);

				if (portalCache == null) {
					portalCache = addCache(name, null);

					[b]if (PropsValues.TRANSACTIONAL_CACHE_ENABLED &amp;&amp;
						isTransactionalPortalCache(name)) {

						portalCache = new TransactionalPortalCache<k, v>(
							portalCache);
					}

					if (PropsValues.EHCACHE_BLOCKING_CACHE_ALLOWED &amp;&amp;
						blocking) {

						portalCache = new BlockingPortalCache<k, v>(
							portalCache);
					}[/b]

					_portalCaches.put(name, portalCache);
				}
			}
		}

		return portalCache;
	}
</k,></k,></k,></k,>