AnsweredAssumed Answered

permissionsAccessChace - shared vs. transactional problem

Question asked by vycitalr on Mar 3, 2008
Latest reply on Mar 12, 2008 by bprucha
Hello,
Can someone explain the princip of transactional vs. shared caches concept in more detail? I have read the javadoc in TransactionalCache but its not fully clear to me. I am experencing following strange behaviour.

In my system there are about 25000 users. Because of this and because I needed to load all users in one query I had to significantly increase the system parameters  system.acl.maxPermissionCheckTimeMillis=800000 and system.acl.maxPermissionChecks=80000. If i didn't I always obtained incomplete users list via lucene.  It has the side-affect that loading the basic folder tree under company home takes more time, especially for the first time until the perimissions are cached. It would be ok, but it happens quite often that the permissionsAccessCache gets in fact cleared by some intensive queries, and it seems to be related to the transactional cache setting.

1. At one instant the state of permissionsAccessCache is following:

16:49:13,981 DEBUG [alfresco.cache.permissionsAccessCache]
===>  EHCache: [  name = org.alfresco.cache.permissionsAccessCache status = STATUS_ALIVE eternal = true overflowToDisk = false maxElementsInMemory = 100000 maxElementsOnDisk = 0 memoryStoreEvictionPolicy = LRU timeToLiveSeconds = 0 timeToIdleSeconds = 0 diskPersistent = false diskExpiryThreadIntervalSeconds = 120 cacheEventListeners:  hitCount = 231726 memoryStoreHitCount = 231726 diskStoreHitCount = 0 missCountNotFound = 302882 missCountExpired = 0 ]
      Hit Ratio:                   43,35 percent     |         Hit Count:         231726 hits        |         Miss Count:        302882 misses  
      Deep Size:                   64,06 MB          |         Current Count:      64968 entries 
      Percentage used:             64,97 percent     |         Max Count:         100000 entries 
      Estimated maximum size:      98,61 MB    
1

2. after that I invoke an intensive query like "search for all users", and after that the cache state is:

16:57:20,082 DEBUG [alfresco.cache.permissionsAccessCache]
===>  EHCache: [  name = org.alfresco.cache.permissionsAccessCache status = STATUS_ALIVE eternal = true overflowToDisk = false maxElementsInMemory = 100000 maxElementsOnDisk = 0 memoryStoreEvictionPolicy = LRU timeToLiveSeconds = 0 timeToIdleSeconds = 0 diskPersistent = false diskExpiryThreadIntervalSeconds = 120 cacheEventListeners:  hitCount = 399146 memoryStoreHitCount = 399146 diskStoreHitCount = 0 missCountNotFound = 390898 missCountExpired = 0 ]
      Hit Ratio:                   50,52 percent     |         Hit Count:         399146 hits        |         Miss Count:        390898 misses  
      Deep Size:                   19,62 MB          |         Current Count:      20002 entries 
      Percentage used:             20,00 percent     |         Max Count:         100000 entries 
      Estimated maximum size:      98,09 MB    


That's quite annoying because there was about 88000 miss count increase, but finally the cache is loaded just with 20000 items - so in nearly empty. One would expect all the misses would be added into the cache, so it is full. I suspect it is caused by setting of permissionsAccessCache where it is set "maxCacheSize=20000" like:

<bean name="permissionsAccessCache" class="org.alfresco.repo.cache.TransactionalCache">
      <property name="sharedCache">
         <ref bean="permissionsAccessSharedCache" />
      </property>
      <property name="cacheManager" >
         <ref bean="transactionalEHCacheManager" />
      </property>
      <!– Eh cache area –>
      <property name="name">
         <value>org.alfresco.permissionsAccessTransactionalCache</value>
      </property>
      <property name="maxCacheSize">
         <value>20000</value>
      </property>
   </bean>

So the problem is, how to setup the cache so that the shared one is not cleared on heavy queries by the transactional. Can I freely increase the size of the transactional cache? It's stated in javadoc: " Because there is a limited amount of space available to the in-transaction caches…"  – how it is limited?

Thanks for any commnets.

Outcomes