Portlet Expiration Caching

The Expiration Cache for specific portlets is declared in your portlet.xml deployment descriptor. At runtime, you can also modify the cache in the Registry admin for your portlet. Caching content helps improve the Portal response time for users. An expiration mechanism is provided on a per portlet basis. Be careful with this feature as cached content, in the Portlet 1.0 specification, the cache is not shared across users. Each user will receive their own cached content. This feature can use up a lot of memory when you have thousands of users. The real advantage to using portlet caching is when you have content that is very expensive, performance-wise, to produce.

Expiration times are defined in the portlet.xml and are specified in seconds:

<portlet>
	<expiration-cache>300</expiration-cache>
</portlet>
  • A value of 0 indicates information is never cached.
  • A value of -1 indicates the cache never expires.

Jetspeed Caches

The Jetspeed portal maintains its several system caches to increase portal performance. These caches can be made distributed, but n the default deployment, they are not distributed. The ehcache.xml file, found under WEB-INF/classes, configures the Jetspeed system caches.

Jetspeed Caches
Cache Description Parameters
portletContentCache JSR-168 Portlet Content Cache This cache implements the JSR-168 caching specification (see Portlet Expiration Caching above). The timeToIdle and timeToLive are set to defaults here, but are always overriden on a per cache-element basis based on the portlet deployment descriptor value. If there are more than 10000 elements it will not by default, overflow to the disk cache, which in this configuration will go to wherever java.io.tmp is defined on your system. On a standard Linux system this will be /tmp timeToIdleSeconds and timeToLiveSeconds to live are both set at 8 hours (28800) this is the default setting for portlets who set their expiration cache as -1 10,000 elements, time to idle/live = 8 hours, overflow to disk = false, LFU
preferencesCache Caches all preference nodes as elements, including user and default preferences. A single user preference can be represented by as many as 8 nodes in memory per user. When calculating your cache size, also consider the default preferences along with the per user preferences requirements. Also see the section below on Preferences Cache Preloading for instructions on preloading the preferences cache. 10,000 elements, time to idle/live = 8 hours, overflow to disk = false, LFU
portletApplicationNameCache Portlet Applications are cached by application name. This cache is hooked into the object-relational database cache and is essential for reasonable performance of the portal. 500 elements, time to idle/live = 8 hours, overflow to disk = false, LFU
portletApplicationOidCache Portlet Applications are cached by object id. This cache is hooked into the object-relational database cache and is essential for reasonable performance of the portal. 500 elements, time to idle/live = 8 hours, overflow to disk = false, LFU
portletDefinitionNameCache Portlet Definition are cached by portlet unique name. This cache is hooked into the object-relational database cache and is essential for reasonable performance of the portal. 2000 elements, time to idle/live = 8 hours, overflow to disk = false, LFU
portletDefinitionOidCache Portlet Definition are cached by object id. This cache is hooked into the object-relational database cache and is essential for reasonable performance of the portal. 2000 elements, time to idle/live = 8 hours, overflow to disk = false, LFU
decorationConfigurationCache 500 elements, time to idle/live = 8 hours, overflow to disk = false, LFU
portletWindowCache Caches portlet window accessor objects to speed up access for portlet fragment to window lookups 200 elements, time to idle/live = 8 hours, overflow to disk = false, LFU
pageManagerOidCache Pages are cached by object id. This cache is hooked into the object-relational database cache and is essential for reasonable performance of the portal. 128 elements, time to idle/live = 150 seconds, overflow to disk = false, LFU
pageManagerPathCache Pages are cached by the page full path. This cache is hooked into the object-relational database cache and is essential for reasonable performance of the portal. 128 elements, time to idle/live = 150 seconds, overflow to disk = false, LFU

General Cache Settings in ehcache.xml
Setting Description
maxElementsInMemory Sets the maximum number of objects that will be created in memory
maxElementsOnDisk Sets the maximum number of objects that will be maintained in the DiskStore The default value is zero, meaning unlimited.
eternal Sets whether elements are eternal. If eternal, timeouts are ignored and the element is never expired.
overflowToDisk Sets whether elements can overflow to disk when the memory store has reached the maxInMemory limit.
timeToIdleSeconds (optional) Sets the time to idle for an element before it expires. i.e. The maximum amount of time between accesses before an element expires Is only used if the element is not eternal. Optional attribute. A value of 0 means that an Element can idle for infinity. The default value is 0.
timeToLiveSeconds (optional) Sets the time to live for an element before it expires. i.e. The maximum time between creation time and when an element expires. Is only used if the element is not eternal. Optional attribute. A value of 0 means that and Element can live for infinity. The default value is 0.
memoryStoreEvictionPolicy Policy would be enforced upon reaching the maxElementsInMemory limit. Default policy is Least Recently Used (specified as LRU). Other policies available - First In First Out (specified as FIFO) and Less Frequently Used (specified as LFU)

Preferences Cache Preloading

To help with preferences performance, preferences can be preloaded at system started. See the Spring configuration file prefs.xml to modify the loading of preferences into the preference cache at Jetspeed startup. Both default and user (entity) preferences can be optionally preloaded. The default setting is to preload all all preferences for the j2-admin portlet application. See the constructor argument 2 on the PreferencesProviderImpl service, to modify the list of portlet applications default preferences to preload. Leave the list empty to not preload default preferences. The third constructor argument determines whether all user (entity) preferences are preloaded or not. The default is to not preload. Be very careful with this setting as it can result in quickly running out of memory at startup.

	
        <!-- list of portlet applications default preferences to preload, leave list empty to not preload -->
        <constructor-arg index='2'>
	    <list>
    		<value>j2-admin</value>
        </list>
        </constructor-arg>
        <!--  preload ALL Entities: warning this can chew up lots of memory -->
        <constructor-arg index='3'><value type="boolean">false</value></constructor-arg>