External caching on Caching Proxy

 

+

Search Tips   |   Advanced Search

 

Overview

The dynamic caching function enables the Caching Proxy to cache dynamically generated content in the form of responses from JSPs and servlets generated by IBM WAS. A Caching Proxy adapter module is used at the appserver to modify the responses, so that they can be cached at the proxy server in addition to being cached in the application server's dynamic cache. With this feature, dynamically generated content can be cached at the entry point to the network, avoiding repeated requests to the application server, when the same content is requested by multiple clients.

The caches on the Caching Proxy and the WAS(s) are synchronized when a new result is generated or a cache object expires. Cached dynamic pages do not expire in the same way that regular files do. They can be invalidated by the appserver that generated them.

Configuration steps

1. Configure the external cache group on the appservers (in our case Trade3Server1, Trade3Server2 and Trade3Server3). Follow the steps outlined in WebSphere External Cache configuration and create an external cache group. Then add a member with these parameters: Address: hostname:port Adapter bean name: com.ibm.websphere.edge.dynacache.WteAdapter

We have created a cache group called ITSO-APPSERV (Figure 14-30) and added our Caching Proxy server to this group (see Figure 14-36).



Figure 14-36 ITSO-APPSERV external cache group member setting

2. Modify the dynaedge-cfg.xml file (in <install_root>/AppServer/properties) and add the external group statement as shown in Example 14-18.

Example 14-18 dynaedge-cfg.xml file

<EdgeServerCfg  CacheManager="ITSO-APPSERV">
<EdgeServer
	    endpoint = "http://cproxy.itso.ibm.com:80"
	    user = "webadmin" 
	    userPasswd = "webadmin" 
	    invalidation-url = "/WES_External_Adapter"
	    URI-type= "absolute"
	/>

The log file <install_root>/appserver/logs/edge/logs/dynacache.log can be used to verify that your dynamic cache adapter was initialized properly.

3. Add a cache policy to the cachespec.xml file for the servlet or JSP file you want to cache. Add <property name="ExternalCache">ITSO-APPSERV </property> for all entries which should be cached by the proxy cache server.

Example 14-19 Cache ID for home servlet

<cache-id>
	<component id="action" type="parameter">
		<value>home</value>
			<required>true</required>
		</component>			
		<component id="JSESSIONID" type="cookie">
			<required>true</required>
		</component>	
		<property name="ExternalCache">ITSO-APPSERV</property>			
		</cache-id>	

4. Configure dynamic caching at the Caching Proxy server.

The configuration changes are done in the caching proxy configuration file ibmproxy.conf. This file is stored in the <install_root>/ibm/edge/cp/etc/en_US directory. Set the Service directive to enable the dynamic caching plug-in as shown in Example 14-20. Note that each directive must appear on a single line in the proxy configuration file.

Example 14-20 Service directive

# ===== JSP Plug-in =====
Service /WES_External_Adapter /opt/ibm/edge/cp/lib/plugins/dynacache/libdyna_plugin.o:exec_dynacmd

Set the ExternalCacheManager directive to specify file sources. Each Caching Proxy must also be configured to recognize the source of the dynamically generated files. See Example 14-21. You need to add an ExternalCacheManager directive to the ibmproxy.conf file for each appserver that caches dynamically generated content at this proxy server. This directive specifies a WAS or the cluster of application servers that caches results at the proxy, and sets a maximum expiration time for content from that server/cluster.

Example 14-21 ExternalCacheManager directive

#ExternalCacheManager directive:
ExternalCacheManager ITSO-APPSERV 20 minutes

Next you need to add a CacheQueries directive to enable cache responses for requests that contain a question mark (?), for example /trade/app?action=home. See Example 14-22.

Example 14-22 CacheQueries directive

#CacheQueries directive:
CacheQueries ALWAYS http://cluster.itso.ibm.com/*

Set the CacheTimeMargin, which specifies the minimum expiration time; files with expiration times below this minimum are not cached. Because query responses sometimes have very short expiration times, setting this directive to a lower setting allows more query responses to be cached. See Example 14-23.

Example 14-23 CacheTimeMargin directive

# CacheTimeMargin directive:
CacheTimeMargin  1 minutes

For more information on configuring dynamic caching in the Caching Proxy, refer to the Caching Proxy Administration Guide, GC09-4601, available on the Internet at:

http://www.ibm.com/software/webservers/appserv/doc/v50/ec/infocenter/index.
html

  Prev | Home | Next

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.