Warning | ||
---|---|---|
| ||
This page is a Work in Progress! I have to run off to a meeting, I'll wrap this up later!'ll continue to add details over the next few days... |
The default uPortal 3 Cache Configuration files are:
- Spring Configuration:
cacheContext.xml
- ehcache Configuration:
ehcache.xml
Configuring Distributed
...
Caching
Configuration
- Configure a
cacheManagerPeerProviderFactory
inehcache.xml
Code Block xml xml <!-- | The rmiUrls is a list of the cache peers of the server being configured. | Do not include the server being configured in the list. +--> <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" properties="peerDiscovery=manual, rmiUrls=${CACHE_PROVIDER_RMIURLS}"/>
Info title Where ${CACHE_PROVIDER_RMIURLS
}=<a pipe-delimited list of the cache peers of the server being configured>
(Do not include the server being configured in the list...)
See the NOTE below for further information regarding the value of this property. - Configure a
cacheManagerPeerListenerFactory
inehcache.xml
Code Block xml xml <cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" properties="//hostname=${CACHE_LISTENER_HOSTNAME},port=${CACHE_LISTENER_PORT}, socketTimeoutMillis=120000"/>
Info title Where ${CACHE_LISTENER_HOSTNAME
}=<app server you are configuring>
${CACHE_LISTENER_PORT
}=40001 - Configure each specific cache that you would like distribute via
cacheEventListenerFactory
inehcache.xml
Code Block xml xml <cache name="org.jasig.portal.security.provider.AuthorizationImpl.AUTH_PRINCIPAL_CACHE" eternal="false" maxElementsInMemory="150" overflowToDisk="false" diskPersistent="false" timeToIdleSeconds="0" timeToLiveSeconds="0" memoryStoreEvictionPolicy="LRU"> <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" properties="replicateAsynchronously=true, replicatePuts=false, replicateUpdates=false, replicateUpdatesViaCopy=false, replicateRemovals=true "/> </cache>
Note title Important! It is important to note that we have configured each cache to use a "invalidation only" strategy by configuring only
replicateRemovals=true
(i.e. - no puts or updates). As I understand it, not everything that is currently being cached in uPortal 3 is guaranteed to implementjava.io.Serializable
and therefore may not be replicated across instances. Furthermore, using an invalidation strategy should reduce network traffic.Info title Configured Caches Note that we chose to enable the distribution of the uPortal Framework and IBasicEntity Caches, but NOT the Hibernate Caches or Portal Stats Hibernate Caches:
uPortal Framework Cachesorg.jasig.portal.security.provider.AuthorizationImpl.AUTH_PRINCIPAL_CACHE
org.jasig.portal.groups.CompositeEntityIdentifier.NAME_PARSE_CACHE
org.jasig.services.persondir.USER_INFO
org.jasig.portal.channels.CONTENT_CACHE
org.jasig.portal.layout.dlm.LAYOUT_CACHE
org.jasig.portal.utils.ResourceLoader.RESOURCE_URL_CACHE
org.jasig.portal.utils.ResourceLoader.RESOURCE_URL_NOT_FOUND_CACHE
uPortal IBasicEntity Caches
org.jasig.portal.ChannelDefinition
org.jasig.portal.groups.IEntityGroup
org.jasig.portal.groups.IEntity
org.jasig.portal.security.IPermissionSet
Anchor rmiUrls rmiUrls Info title rmiUrls Property Value It is (unfortunately) necessary to populate the
rmiUrls
property value differently for each cache peer included in the distribution matrix. Furthermore, each configured cache must be included on this list for each peer, so as you can imagine this value can become exceedingly long and difficult to read and manage. So, for example, I have listed the specific configuration values for what a 3 server configuration might look like below. (To "simplify" the management of these values, it might be advantageous to incorporate these property values into your specific deployment process via tokenization...)
For app1:
rmiUrls=//app2.foo.edu:40001/org.jasig.portal.security.provider.AuthorizationImpl.AUTH_PRINCIPAL_CACHE|//app2.foo.edu:40001/org.jasig.portal.groups.CompositeEntityIdentifier.NAME_PARSE_CACHE|//app2.foo.edu:40001/org.jasig.services.persondir.USER_INFO|//app2.foo.edu:40001/org.jasig.portal.channels.CONTENT_CACHE|//app2.foo.edu:40001/org.jasig.portal.layout.dlm.LAYOUT_CACHE|//app2.foo.edu:40001/org.jasig.portal.ChannelDefinition|//app2.foo.edu:40001/org.jasig.portal.groups.IEntityGroup|//app2.foo.edu:40001/org.jasig.portal.groups.IEntity|//app2.foo.edu:40001/org.jasig.portal.utils.ResourceLoader.RESOURCE_URL_CACHE|//app2.foo.edu:40001/org.jasig.portal.utils.ResourceLoader.RESOURCE_URL_NOT_FOUND_CACHE|//app2.foo.edu:40001/edu.jhu.services.persondir.support.http.CACHE|//app2.foo.edu:40001/org.jasig.portal.security.IPermissionSet|//app3.foo.edu:40001/org.jasig.portal.security.provider.AuthorizationImpl.AUTH_PRINCIPAL_CACHE|//app3.foo.edu:40001/org.jasig.portal.groups.CompositeEntityIdentifier.NAME_PARSE_CACHE|//app3.foo.edu:40001/org.jasig.services.persondir.USER_INFO|//app3.foo.edu:40001/org.jasig.portal.channels.CONTENT_CACHE|//app3.foo.edu:40001/org.jasig.portal.layout.dlm.LAYOUT_CACHE|//app3.foo.edu:40001/org.jasig.portal.ChannelDefinition|//app3.foo.edu:40001/org.jasig.portal.groups.IEntityGroup|//app3.foo.edu:40001/org.jasig.portal.groups.IEntity|//app3.foo.edu:40001/org.jasig.portal.utils.ResourceLoader.RESOURCE_URL_CACHE|//app3.foo.edu:40001/org.jasig.portal.utils.ResourceLoader.RESOURCE_URL_NOT_FOUND_CACHE|//app3.foo.edu:40001/edu.jhu.services.persondir.support.http.CACHE|//app3.foo.edu:40001/org.jasig.portal.security.IPermissionSet
For app2:
rmiUrls=//app1.foo.edu:40001/org.jasig.portal.security.provider.AuthorizationImpl.AUTH_PRINCIPAL_CACHE|//app1.foo.edu:40001/org.jasig.portal.groups.CompositeEntityIdentifier.NAME_PARSE_CACHE|//app1.foo.edu:40001/org.jasig.services.persondir.USER_INFO|//app1.foo.edu:40001/org.jasig.portal.channels.CONTENT_CACHE|//app1.foo.edu:40001/org.jasig.portal.layout.dlm.LAYOUT_CACHE|//app1.foo.edu:40001/org.jasig.portal.ChannelDefinition|//app1.foo.edu:40001/org.jasig.portal.groups.IEntityGroup|//app1.foo.edu:40001/org.jasig.portal.groups.IEntity|//app1.foo.edu:40001/org.jasig.portal.utils.ResourceLoader.RESOURCE_URL_CACHE|//app1.foo.edu:40001/org.jasig.portal.utils.ResourceLoader.RESOURCE_URL_NOT_FOUND_CACHE|//app1.foo.edu:40001/edu.jhu.services.persondir.support.http.CACHE|//app1.foo.edu:40001/org.jasig.portal.security.IPermissionSet|//app3.foo.edu:40001/org.jasig.portal.security.provider.AuthorizationImpl.AUTH_PRINCIPAL_CACHE|//app3.foo.edu:40001/org.jasig.portal.groups.CompositeEntityIdentifier.NAME_PARSE_CACHE|//app3.foo.edu:40001/org.jasig.services.persondir.USER_INFO|//app3.foo.edu:40001/org.jasig.portal.channels.CONTENT_CACHE|//app3.foo.edu:40001/org.jasig.portal.layout.dlm.LAYOUT_CACHE|//app3.foo.edu:40001/org.jasig.portal.ChannelDefinition|//app3.foo.edu:40001/org.jasig.portal.groups.IEntityGroup|//app3.foo.edu:40001/org.jasig.portal.groups.IEntity|//app3.foo.edu:40001/org.jasig.portal.utils.ResourceLoader.RESOURCE_URL_CACHE|//app3.foo.edu:40001/org.jasig.portal.utils.ResourceLoader.RESOURCE_URL_NOT_FOUND_CACHE|//app3.foo.edu:40001/edu.jhu.services.persondir.support.http.CACHE|//app3.foo.edu:40001/org.jasig.portal.security.IPermissionSet
For app3:
rmiUrls=//app1.foo.edu:40001/org.jasig.portal.security.provider.AuthorizationImpl.AUTH_PRINCIPAL_CACHE|//app1.foo.edu:40001/org.jasig.portal.groups.CompositeEntityIdentifier.NAME_PARSE_CACHE|//app1.foo.edu:40001/org.jasig.services.persondir.USER_INFO|//app1.foo.edu:40001/org.jasig.portal.channels.CONTENT_CACHE|//app1.foo.edu:40001/org.jasig.portal.layout.dlm.LAYOUT_CACHE|//app1.foo.edu:40001/org.jasig.portal.ChannelDefinition|//app1.foo.edu:40001/org.jasig.portal.groups.IEntityGroup|//app1.foo.edu:40001/org.jasig.portal.groups.IEntity|//app1.foo.edu:40001/org.jasig.portal.utils.ResourceLoader.RESOURCE_URL_CACHE|//app1.foo.edu:40001/org.jasig.portal.utils.ResourceLoader.RESOURCE_URL_NOT_FOUND_CACHE|//app1.foo.edu:40001/edu.jhu.services.persondir.support.http.CACHE|//app1.foo.edu:40001/org.jasig.portal.security.IPermissionSet|//app2.foo.edu:40001/org.jasig.portal.security.provider.AuthorizationImpl.AUTH_PRINCIPAL_CACHE|//app2.foo.edu:40001/org.jasig.portal.groups.CompositeEntityIdentifier.NAME_PARSE_CACHE|//app2.foo.edu:40001/org.jasig.services.persondir.USER_INFO|//app2.foo.edu:40001/org.jasig.portal.channels.CONTENT_CACHE|//app2.foo.edu:40001/org.jasig.portal.layout.dlm.LAYOUT_CACHE|//app2.foo.edu:40001/org.jasig.portal.ChannelDefinition|//app2.foo.edu:40001/org.jasig.portal.groups.IEntityGroup|//app2.foo.edu:40001/org.jasig.portal.groups.IEntity|//app2.foo.edu:40001/org.jasig.portal.utils.ResourceLoader.RESOURCE_URL_CACHE|//app2.foo.edu:40001/org.jasig.portal.utils.ResourceLoader.RESOURCE_URL_NOT_FOUND_CACHE|//app2.foo.edu:40001/edu.jhu.services.persondir.support.http.CACHE|//app2.foo.edu:40001/org.jasig.portal.security.IPermissionSet
...
Monitoring ehcache using JMX and JConsole
ehcache Management and Statistics are enabled in the jmxContext.xml
Spring configuration file:
Code Block | ||||
---|---|---|---|---|
| ||||
<!-- Ref to the mbean server --> <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean"> <property name="locateExistingServerIfPossible" value="true" /> </bean> . . . <!-- EhCache management and statistics --> <bean class="org.springframework. |
...
beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass" value="net.sf.ehcache.management.ManagementService" />
<property name="targetMethod" value="registerMBeans" />
<property name="arguments">
<list>
<ref bean="cacheManager" />
<ref bean="mbeanServer" />
<value>true</value>
<value>true</value>
<value>true</value>
<value>true</value>
</list>
</property>
</bean>
|
...
Relevent Documentation and Links
...
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study on Wotif.com (A nice caching overview article)
http://developers.sun.com/learning/javaoneonline/2007/pdf/TS-6175.pdf
Remote Network debugging and monitoring for Distributed Caches
http://ehcache.sourceforge.net/documentation/remotedebugger.html
JMX Management and Monitoring
http://ehcache.sourceforge.net/documentation/jmx.html
The Apache Tomcat 5.5 Servlet/JSP Container - Monitoring and Managing Tomcat
http://tomcat.apache.org/tomcat-5.5-doc/monitoring.html
Monitoring and Management Using JMX
http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html
Using JConsole to Monitor Applications
http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html