IBM Support

IBM DataPower Document Cache to cache response content

Question & Answer


Question

Can I configure the DataPower appliance to cache responses to POST, PUT, and other appliance initiated requests?

Cause

Absolutely. The Document cache feature called "Cache response to POST and PUT requests" is the key.

Answer

Understanding there are two "sides" of the appliance. The front side i.e. client to appliance and the back side i.e. appliance to a content server.

The document cache will cache content based on a few basic settings. To enable this within a service simply enable the document cache policy by setting the Document Cache Size to be large enough to handle the response content:

1. On the Document Cache Policy panel configure a URL match expression, */ or */very/specific/url/*

2. Set a TTL for the lifetime you want the appliance to hold the content for reuse.


    * This TTL is unique to the appliance and has nothing to do with the HTTP Cache-Control header.

3. Pick your policy type. For the most part, fixed is simple for testing and proof of concept.

4. Enable the Cache response to PUT and POST requests option.

The URL match expression from the Doc cache policy will match on the back side request sent. The key to trigger caching also requires that the appliance request contains the HTTP header "x-dp-cache-key". This can be as simple as "x-dp-cache-key: here" or "x-dp-cache-key: 123"

Some consistent value set, an empty header will not work.

Once this is configured you can test to see that the cache is working by checking the document cache state;


xi52[MyDomain]# show documentcache MyXMLManager detailed

Expiration Time URL Cache Key
------------------------ ---------------------- ---------
Tue Apr 1 10:27:34 2014 http://10.3.4.5:9009/ here

Document cache bytes used: 0.00% of 9765KB
Documents cached: 1/5000

TTL Pri Policy Match
------- --- ----------------
900 128 */

Reading this output we can see that there is an entry in the cache and the time it will expire.

When an appliance issues a request to the backend and hits this cache you will see in the logs:


20140331T181850Z [0x80e00162][ws-proxy][debug] wsgw(CacheTest): tid(225505)[10.2.3.4]: Document Cache Reuse: http://10.3.4.5:9009/

There will be further logs that appear to show backend connections but this is not the case, you can confirm via packet trace that no backend connection was actually made. The appliance is simply filling in the log messages with the URL string encoded to the cache entry.

If you have problems or questions with this functionality please collect;

- A probe capture

- Debug log of the transaction

- If possible, a packet trace will all help to view the behavior

- CLI outputs showing the document cache details (the same command shown above)

[{"Product":{"code":"SS9H2Y","label":"IBM DataPower Gateway"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"General","Platform":[{"code":"PF009","label":"Firmware"}],"Version":"4.0;5.0.0;6.0.0;6.0.1","Edition":"Edition Independent","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
08 June 2021

UID

swg21669045