Setup Web service cache [server sided]
Posted by eichelgartenweg on 11:33 AM with 1 comment
In this post i will explain how to use the web service server cache in WebSphere Application Server 6.1.
1. First you need to active the dynamic cache service and servlet caching in WebSphere via the administrative console
1.1. Navigate to Servers > Application servers > "your server" > Container services > Dynamic cache service
1.2 Activate "Enable service at startup" and click "OK" and "Save" to apply this setting.
1.3 Navigate to Servers > Application serves > "your server" > Web Container Settings > Web container
1.4 Activate "Enable servlet caching" and click "OK" and "Save" to apply this setting.
1.3 Restart server
2. Deploy the dynamic cache monitor to get a view of current state of the dynamic cache service
2.1 Locate the CacheMonitor.ear under "WebSphere-System-Root"\installableApps\
2.2 Deploy the ear-File (standard context root: cachemonitor)
3. Add a cachespec.xml (and the cachespec.dtd (located at /"websphere-sys-root"/properties) to your webservice project (Folder WEB-INF/)
3.1 The cachespec.xml should look like this:
3.2 (Re-)deploy the Web service application
Hint:
A sample cachespec-file can be found at "WebSphere-System-Root"/properties
Hint 2:
To enable web service cache through a Web services gateway (WSGW) see this link.
1. First you need to active the dynamic cache service and servlet caching in WebSphere via the administrative console
1.1. Navigate to Servers > Application servers > "your server" > Container services > Dynamic cache service
1.2 Activate "Enable service at startup" and click "OK" and "Save" to apply this setting.
1.3 Navigate to Servers > Application serves > "your server" > Web Container Settings > Web container
1.4 Activate "Enable servlet caching" and click "OK" and "Save" to apply this setting.
1.3 Restart server
2. Deploy the dynamic cache monitor to get a view of current state of the dynamic cache service
2.1 Locate the CacheMonitor.ear under "WebSphere-System-Root"\installableApps\
2.2 Deploy the ear-File (standard context root: cachemonitor)
3. Add a cachespec.xml (and the cachespec.dtd (located at /"websphere-sys-root"/properties) to your webservice project (Folder WEB-INF/)
3.1 The cachespec.xml should look like this:
<cache>
<cache-entry>
<class>webservice</class>
<name>"service name"</name>
<sharing-policy>not-shared</sharing-policy>
<cache-id>
<component id="Hash" type="SOAPEnvelope" />
<timeout>420</timeout>
</cache-id>
</cache-entry>
</cache>
"service name" = e.g. /services/Repository<cache-entry>
<class>webservice</class>
<name>"service name"</name>
<sharing-policy>not-shared</sharing-policy>
<cache-id>
<component id="Hash" type="SOAPEnvelope" />
<timeout>420</timeout>
</cache-id>
</cache-entry>
</cache>
3.2 (Re-)deploy the Web service application
Hint:
A sample cachespec-file can be found at "WebSphere-System-Root"/properties
Hint 2:
To enable web service cache through a Web services gateway (WSGW) see this link.
how effective is this on portal? i mean if i was to follow your steps on the WAS side of portal, do you think there would be a performance gain? what are the downfalls to using caching let's say if we update a portlet/application within portal?
ReplyDeleteThanks for the easy tips!