Repository Cache Configuration

cancel
Showing results for 
Search instead for 
Did you mean: 

Repository Cache Configuration

resplin
Intermediate
0 0 5,020

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



High AvailabilityCaching
Back to Server Configuration


Introduction


The Alfresco repository features various in-memory caches. The caches are implemented using the Ehcache library, they are transaction safe and clusterable.


Memory settings


The cache makes a huge positive difference to the performance of the Alfresco repository but they can consume considerable Java heap memory.

The settings used for the caches depend on your particular use case and the amount of memory available to your Alfresco server. However, the default ehcache.xml file  is adequate for most systems and is currently (for version 1.2) setup for approx 512MB of cache heap memory - this is the recommended default for a Java heap size of 1GB.


Individual Cache Settings


Each cache is configured in an XML block similar to this:



    <cache
        name='org.alfresco.cache.node.rootNodesCache'
        maxElementsInMemory='500'
        eternal='true'
        overflowToDisk='false'
        statistics='false'
        />
   

The name attribute is the name of the cache and generally indicates the type of objects being cached. The maxElementsInMemory is important as it controls the maximum size of the cache. This value can be changed to tune the size of the cache for your system.

The cached objects will be garbage collected by means of weak referencing should memory become a problem.  It should be noted that some object references are effectively shared by the caches e.g. so the amount of memory used is generally not as high as the approximate value may suggest - but it's best to err on the side of caution. Using the tracing as below can help determine which caches fill up quickly for your particular server use-case.


Tracing cache sizes


The following logging category can be set to DEBUG to output detailed Ehcache usage information:

org.alfresco.repo.cache.EhCacheTracerJob

To target specific caches, you can append the cache name or package:

org.alfresco.repo.cache.EhCacheTracerJob.org.alfresco

The configuration file <configRoot>/alfresco/scheduled-jobs-context.xml contains the following relevant beans:


  • ehCacheTracerJob
Override this bean to change the trigger schedule.
Enable the scheduler property to activate the trigger.

When triggered, the job will collect detailed cache usage statistics and output them to the log/console, depending on how logging has been configured for the server.


  • Set caches to use statistics

Add a custom cache configuration file so that caches use statistics:



        statistics='true'

(See the Wiki page on how to override the repository configuration)


Example Trace Log


The following example is from a test of the 1.2 Alfresco Repository running a simple 150 concurrent user test scenario. Randomly selected from a pool of 1000 test users, a user logs in, views their home space, uploads a small file to the repository and logs out. This test ensures that new objects are continually added to the caches as the new files are added by random users.

Some objects are shared between the caches, so the reported sizes are an overestimate in some cases.  Nevertheless, they serve as a useful indication of relative sizes.



09:09:34,458 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.domain.hibernate.NodeImpl.sourceNodeAssocs
      Hit Count:                   56245 hits        |         Miss Count:         20102 misses  
      Deep Size:                   19.62 MB          |         Current Count:       5000 entries 
      Percentage used:            100.00 percent     |         Max Count:           5000 entries 
      Estimated maximum size:      19.62 MB    
09:10:06,099 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.domain.hibernate.NodeImpl.targetNodeAssocs
      Hit Count:                   56253 hits        |         Miss Count:         20114 misses  
      Deep Size:                   19.62 MB          |         Current Count:       5000 entries 
      Percentage used:            100.00 percent     |         Max Count:           5000 entries 
      Estimated maximum size:      19.62 MB    
09:10:06,099 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.domain.hibernate.VersionCountImpl
      Hit Count:                       0 hits        |         Miss Count:             0 misses  
      Deep Size:                    0.00 MB          |         Current Count:          0 entries 
      Percentage used:              0.00 percent     |         Max Count:            100 entries 
      Estimated maximum size:        NaN MB    
09:10:06,115 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.domain.hibernate.NodeAssocImpl
      Hit Count:                       0 hits        |         Miss Count:             0 misses  
      Deep Size:                    0.00 MB          |         Current Count:          0 entries 
      Percentage used:              0.00 percent     |         Max Count:           1000 entries 
      Estimated maximum size:        NaN MB    
09:10:06,131 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.hibernate.cache.StandardQueryCache
      Hit Count:                       0 hits        |         Miss Count:             0 misses  
      Deep Size:                    0.00 MB          |         Current Count:          0 entries 
      Percentage used:              0.00 percent     |         Max Count:             50 entries 
      Estimated maximum size:        NaN MB    
09:10:06,693 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.security.permissions.impl.hibernate.NodePermissionEntryImpl.permissionEntries
      Hit Count:                 1807540 hits        |         Miss Count:          3994 misses  
      Deep Size:                    8.23 MB          |         Current Count:       1997 entries 
      Percentage used:             19.97 percent     |         Max Count:          10000 entries 
      Estimated maximum size:      41.22 MB    
09:10:11,287 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.domain.hibernate.NodeImpl.properties
      Hit Count:                10226356 hits        |         Miss Count:       2389157 misses  
      Deep Size:                   56.80 MB          |         Current Count:      10000 entries 
      Percentage used:            100.00 percent     |         Max Count:          10000 entries 
      Estimated maximum size:      56.80 MB    
09:10:11,724 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.security.permissions.impl.hibernate.NodePermissionEntryImpl
      Hit Count:                 1807617 hits        |         Miss Count:       2178190 misses  
      Deep Size:                    8.38 MB          |         Current Count:       1997 entries 
      Percentage used:             19.97 percent     |         Max Count:          10000 entries 
      Estimated maximum size:      41.96 MB    
09:10:11,724 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.domain.hibernate.StoreImpl
      Hit Count:                 2098289 hits        |         Miss Count:             8 misses  
      Deep Size:                    0.02 MB          |         Current Count:          4 entries 
      Percentage used:              4.00 percent     |         Max Count:            100 entries 
      Estimated maximum size:       0.40 MB    
09:10:11,881 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  nodeOwnerCache
      Hit Count:                 4229936 hits        |         Miss Count:       2261071 misses  
      Deep Size:                    2.20 MB          |         Current Count:       4372 entries 
      Percentage used:             21.86 percent     |         Max Count:          20000 entries 
      Estimated maximum size:      10.05 MB    
09:10:12,084 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.security.permissions.impl.hibernate.RecipientImpl
      Hit Count:                 5280149 hits        |         Miss Count:          2000 misses  
      Deep Size:                    4.26 MB          |         Current Count:       1000 entries 
      Percentage used:             10.00 percent     |         Max Count:          10000 entries 
      Estimated maximum size:      42.60 MB    
09:10:12,365 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.security.permissions.impl.hibernate.PermissionEntryImpl
      Hit Count:                 5358967 hits        |         Miss Count:          3996 misses  
      Deep Size:                    5.38 MB          |         Current Count:       3996 entries 
      Percentage used:             15.98 percent     |         Max Count:          25000 entries 
      Estimated maximum size:      33.66 MB    
09:10:12,365 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  webservice.QuerySessionCache
      Hit Count:                       0 hits        |         Miss Count:             0 misses  
      Deep Size:                    0.00 MB          |         Current Count:          0 entries 
      Percentage used:              0.00 percent     |         Max Count:          10000 entries 
      Estimated maximum size:        NaN MB    
09:10:14,959 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.domain.hibernate.NodeImpl
      Hit Count:                10114354 hits        |         Miss Count:       1997684 misses  
      Deep Size:                   44.39 MB          |         Current Count:      10000 entries 
      Percentage used:            100.00 percent     |         Max Count:          10000 entries 
      Estimated maximum size:      44.39 MB    
09:10:17,193 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.domain.hibernate.NodeStatusImpl
      Hit Count:                   96328 hits        |         Miss Count:         42684 misses  
      Deep Size:                   20.82 MB          |         Current Count:       5000 entries 
      Percentage used:            100.00 percent     |         Max Count:           5000 entries 
      Estimated maximum size:      20.82 MB    
09:10:17,209 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  userToAuthorityCache
      Hit Count:                12514964 hits        |         Miss Count:         49745 misses  
      Deep Size:                    0.03 MB          |         Current Count:        125 entries 
      Percentage used:              1.25 percent     |         Max Count:          10000 entries 
      Estimated maximum size:       2.59 MB    
09:10:19,678 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.domain.hibernate.NodeImpl.aspects
      Hit Count:                 4817824 hits        |         Miss Count:       2357164 misses  
      Deep Size:                   43.43 MB          |         Current Count:      10000 entries 
      Percentage used:            100.00 percent     |         Max Count:          10000 entries 
      Estimated maximum size:      43.43 MB    
09:10:19,693 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.domain.hibernate.AppliedPatchImpl
      Hit Count:                      45 hits        |         Miss Count:             5 misses  
      Deep Size:                    0.01 MB          |         Current Count:          5 entries 
      Percentage used:              5.00 percent     |         Max Count:            100 entries 
      Estimated maximum size:       0.14 MB    
09:10:25,365 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.domain.hibernate.NodeImpl.childAssocs
      Hit Count:                  839077 hits        |         Miss Count:       1149644 misses  
      Deep Size:                  100.35 MB          |         Current Count:      25000 entries 
      Percentage used:            100.00 percent     |         Max Count:          25000 entries 
      Estimated maximum size:     100.35 MB    
09:10:25,365 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.hibernate.cache.UpdateTimestampsCache
      Hit Count:                      56 hits        |         Miss Count:             0 misses  
      Deep Size:                    0.00 MB          |         Current Count:          7 entries 
      Percentage used:              0.14 percent     |         Max Count:           5000 entries 
      Estimated maximum size:       1.41 MB    
09:10:25,365 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.security.permissions.impl.hibernate.PermissionReferenceImpl
      Hit Count:                 3504794 hits        |         Miss Count:            12 misses  
      Deep Size:                    0.03 MB          |         Current Count:          6 entries 
      Percentage used:              1.20 percent     |         Max Count:            500 entries 
      Estimated maximum size:       2.10 MB    
09:10:28,100 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.domain.hibernate.ChildAssocImpl
      Hit Count:                 5129388 hits        |         Miss Count:       1269083 misses  
      Deep Size:                   39.60 MB          |         Current Count:      25000 entries 
      Percentage used:            100.00 percent     |         Max Count:          25000 entries 
      Estimated maximum size:      39.60 MB    
09:10:30,881 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.domain.hibernate.NodeImpl.parentAssocs
      Hit Count:                 3400589 hits        |         Miss Count:       2431389 misses  
      Deep Size:                   40.10 MB          |         Current Count:      10000 entries 
      Percentage used:            100.00 percent     |         Max Count:          10000 entries 
      Estimated maximum size:      40.10 MB    
09:10:30,881 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  org.alfresco.repo.security.permissions.impl.hibernate.RecipientImpl.externalKeys
      Hit Count:                       0 hits        |         Miss Count:             0 misses  
      Deep Size:                    0.00 MB          |         Current Count:          0 entries 
      Percentage used:              0.00 percent     |         Max Count:           5000 entries 
      Estimated maximum size:        NaN MB    
09:10:31,428 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  permissionsAccessCache
      Hit Count:                 2610635 hits        |         Miss Count:       6148423 misses  
      Deep Size:                    6.02 MB          |         Current Count:      12165 entries 
      Percentage used:             24.33 percent     |         Max Count:          50000 entries 
      Estimated maximum size:      24.75 MB    
09:10:31,615 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob]    Analyzing EHCache:
===>  nullPermissionCache
      Hit Count:                 9035796 hits        |         Miss Count:      19266775 misses  
      Deep Size:                    2.55 MB          |         Current Count:       3519 entries 
      Percentage used:             35.19 percent     |         Max Count:          10000 entries 
      Estimated maximum size:       7.23 MB    
09:10:31,615 DEBUG [org.alfresco.repo.cache.EhCacheTracerJob] EHCaches currently consume 421.84 MB or 28.20% VM size

Overriding the EHCache Defaults


You can modify your cache defaults by copying the following:
<configRoot>/alfresco/ehcache-default.xml  to <extension>/ehcache-custom.xml .