6.6.  Configure and monitor the WebSphere caching mechanisms.

[Note]

The dynamic cache service improves performance by caching the output of Java Servlets, commands, and JavaServer Pages (JSP) files. WebSphere Application Server consolidates several caching activities, including Servlets, Web Services, and WebSphere commands, into one service called the dynamic cache. These caching activities work together to improve application performance and share many configuration parameters that are set in an application server's dynamic cache service.

The dynamic cache works within an application server Java Virtual Machine (JVM), intercepting calls to cacheable objects, for example, through a Java Servlet's service() method or a command's execute() method The dynamic cache either stores the object's output to or serves the object's content from the dynamic cache. Because Java EE applications have high read/write ratios and can tolerate small degrees of latency in the currency of their data, the dynamic cache can create an opportunity for significant gains in server response time, throughput, and scalability.

Using the dynamic cache service

Use the dynamic cache service to improve application performance by caching the output of servlets, web services, and WebSphere Application Server commands into memory.

The dynamic cache service is enabled by default. You can configure the default cache instance, as follows:

  1. Click Servers > Server Types > WebSphere application servers > server_name > Container services > Dynamic cache service.

    Figure 6.34. Dynamic cache service

    Dynamic cache service


  2. Configure the default cache instance or follow the links to enable servlet or portlet caching.

    Figure 6.35. 


  3. Select Enable servlet caching under the Configuration tab.

    Figure 6.36. 


  4. Save changes. Restart WebSphere Application Server.

Configuring servlet caching

After a servlet is invoked and completes generating the output to cache, a cache entry is created containing the output and the side effects of the servlet. These side effects can include calls to other servlets or JavaServer Pages (JSP) files or metadata about the entry, including timeout and entry priority information. Configure servlet caching to save the output of servlets and JavaServer Pages (JSP) files to the dynamic cache.

Unique entries are distinguished by an ID string that is generated from the HttpServletRequest object each time the servlet runs. You can then base servlet caching on:

Because JavaServer Pages files are compiled into servlets, the dynamic cache function treats JavaServer Pages files the same as servlets, except in specifically documented situations.

  1. In the administrative console, click Servers > Server Types > WebSphere application servers > server_name > Web container settings > Web container in the console navigation tree.

  2. Select Enable servlet caching under the Configuration tab.

    Figure 6.37. 


  3. Click Apply or OK.

  4. Restart WebSphere Application Server.

Define the cache policy for your servlets by configuring cacheable objects with the WEB-INF/cachespec.xml file.

Professional hosting         Free 'Oracle Certified Expert Web Services Developer 6' Guide     Free SCDJWS 5.0 Guide