Entering content frameFunction documentation Caching BSPs Locate the document in its SAP Library structure

Use

With the Internet Server Cache (see also ICM Server-Cache) you can considerably increase the performance and scalability of your BSP application. The ICM server cache provides a dynamic and active content caching technology, resulting in the following advantages for developing BSPs:

The possible performance improvements can be up to factor 20.

Performance and Scalability

Benchmarking tests for cache hits in the main memory have resulted in latent response times of less than one millisecond per request, and a total run of under 3,000 requests per second on a 4 CPU hardware.

These results are based on a strong parallel and multithreaded architecture that supports simultaneous read and write accesses with versioning. Furthermore, a patented indexing algorithm is used to access the cache directory quickly. This algorithm is particularly suitable for long Web URLs as cache keys.

Functions

The features and the architecture of the ICM server cache are described in Internet Server Cache.

You have the following options to control BSP caching:

The following section describes how you should proceed.

Activities

Setting Caching Properties in the Web Application Builder

You can set the caching properties for the page on the Properties tab page of a BSP:

This graphic is explained in the accompanying text

For both the browser cache and the ICM server cache you can determine how long the page should be held in the cache. If you do not enter any data, this means that the cache is not used for the page. Set flag Browser Dependent if you want the ICM server cache to fetch the page from the cache only if the request comes from the same browser type. If you do not set the flag, note that all of the elements used by the page must not be browser-dependent.

Caution

Note that when you use the browser cache, the client cannot tell when a page has changed. If the URL is the same, it always returns the same page from the cache until the expiry date has passed. If you use the ICM server cache, by using the invalidation methods you can ensure that the page stored in the cache is up-to-date.

Setting Caching Properties Using Method Calls in the BSP

You have several options here. In addition to the relative expiry date and browser-dependency, you can specify a final expiry date and invalidate cache entries. You can also activate caching not just for the page in general, but also according to user input.

Set the expiry time for an HTTP response with the methods of class CL_HTTP_RESPONSE (see also Structure linkIF_HTTP_RESPONSE and IF_HTTP_REQUEST):

Note

Use appropriate automatic expiry times. For example, a banner displaying stock market tickers is updated every n minutes, whilst a product catalog should be updated only every n days or weeks.

You refresh (invalidate) objects asynchronously using the methods of class CL_HTTP_SERVER (see also Structure linkIF_HTTP_SERVER):

The system automatically forwards this data to other application servers, thus ensuring cache integrity.

Note

You should avoid too frequent invalidations, so that system-wide transfers to other application servers are avoided.

See also:

Manipulating Cache Properties

Example

You can find a simple example in the system in BSP application TUTORIAL_4, BSP results.htm in the event handler OnInitialization:

* cache result page in case Plattner's books are searched

 

if 'PLATTNER' cp author.

response->server_cache_expire_abs( expires_abs_time = '180000'

browser_dependent = 'X' ).

    endif.

The result list for querying the books from Hasso Plattner is only stored in the cache because you know that these are requested especially often. The cache entry is invalidated every night at 18.00. This function may be useful for things that must be recalculated every day (such as current prices).

See also:

Structure linkFurther Developing the Online Bookshop

 

 

Leaving content frame