Configure Edge Server Include processor caching
Edge Side Include (ESI) is configured through the plugin-cfg.xml file.
The Web server plug-in contains a built-in ESI processor. The ESI processor has the ability to cache fragments and whole pages, which provides a higher cache hit ratio. The ESI processor implements an in-memory cache, and the cache entries are not saved when the Web server is restarted.
The Web server plug-in receives a request and sends that request to the ESI processor, unless the ESI processor is disabled. (It is enabled by default.) If a cache miss occurs, a Surrogate-Capabilities header is added to the request, and the request forwards to WAS. If the dynamic servlet cache is enabled in the application server, and the response is edge-cacheable, the application server returns a Surrogate-Control header in the response to the WebSphere Application Server plug-in.
The value of the Surrogate-Control response header contains the list of rules that are used by the ESI processor to generate the cache ID. The response is stored in the ESI cache and uses the cache ID as the key. For each ESI include tag in the response, a new request processes and includes results in a cache hit or another request that forwards to the application server. When all nested includes are processed, the page assembles and returns to the client.
The WAS Web server configures the ESI processor through its plugin-cfg.xml configuration file. The following snippet illustrates the ESI configuration options:
<?xml version-"1.0"?> <Config> <Property Name="esiEnable" Value="false"/> <Property Name="esiMaxCacheSize" Value="1024"/> <Property Name="esiInvalidationMonitor" Value="false"/>
Use esiEnable to enable or disable the ESI processor (ESI is disabled by default for new instances). If ESI is disabled, then the other ESI options are ignored.
Use esiMaxCacheSize to set the maximum size of the cache in kilobytes. The default maximum size of the cache is 1MB. If the cache is full, the least recently used entry is removed from the cache.
Use esiInvalidationMonitor to specify if the ESI processor should receive invalidations from the application server. ESI works well when the Web servers following a threading model is used, and only one process is started. When multiple processes are started, each process caches the responses independently and the cache is not shared. As a result, the system's memory might be fully consumed by the ESI processor.
There are three ways that entries are removed from the ESI cache: an entry's expiration timeout fires, an entry is purged to make room for newer entries, or the application server sends an explicit invalidation for a group of entries. To enable invalidation for a group of entries, the esiInvalidationMonitor property must be set to true, and the DynaCacheEsi application must be installed on the application server. The DynaCacheEsi application is located in the /QIBM/ProdData/WebAS5/Base/installableApps directory and is named DynaCacheEsi.ear. If the ESIInvalidationMonitor property is set to true but the DynaCacheEsi application is not installed, then errors occur in the Web server plugin, and the request fails.
The ESI processor's cache can be monitored through the CacheMonitor application. The DynaCacheEsi application must be installed, and the ESIInvalidationMonitor property must be set to true in the plugin-cfg.xml file for the ESI processor's cache to be visible in the CacheMonitor. For information about edge cache statistics that you can view with the cache monitor, see Edge cache statistics.
When you serve static data in WAS (such as images and HTML), the ESI processor also caches the URLs. This data has a default timeout of 300 seconds. You can change the timeout value by adding the com.ibm.servlet.file.esi.timeOut property to the JVM. To add the property, follow these steps:
- Start the WAS administrative console.
- Expand Servers and click Application Servers.
- Click on the server you want to change.
- In the Additional Properties, click Process Definition.
- In the Additional Properties, click Java Virtual Machine.
- In the Additional Properties, click Custom Properties.
- On the Custom Properties page, click New.
- Type com.ibm.servlet.file.esi.timeOut in the Name field. Specify the timeout value in the Value field. For example, for a one minute timeout, use 60.
- Click OK.
- Save the administrative configuration
Note: You must restart your application server for the changes to take effect.
For information about configuring alternate URL, see Configure alternate URL.