ADC

Improve cache performance

You can improve the performance of integrated cache, including handling simultaneous requests for the same cached data, avoiding delays that are associated with refreshing cached responses from the origin server, and ensuring that a response is requested often enough to be worth caching.

Reduce flash crowds

Flash crowds occur when many users simultaneously request the same data. All of the requests in a flash crowd can become cache misses if you configured the cache to serve hits only after the entire object is downloaded.

The following techniques can reduce or eliminate flash crowds:

  • PREFETCH: Refreshes a positive response before it expires to ensure that it never becomes stale or inactive. For more information, see “Refreshing a Response Prior to Expiration” section.
  • Cache buffering: Starts serving a response to multiple clients as soon as it receives the response header from the origin server, rather than waiting for the entire response to be downloaded. The only limit on the number of clients that can download a response simultaneously is the available system resources. The Citrix ADC appliance downloads and serves responses even if the client that initiated the download halts before the download is complete. If the size of the response exceeds the cache size or if the response is chunked, the cache stops storing the response, but service to the clients is not disrupted.
  • Flash Cache: Flash Cache queues requests to the cache, and allows only one request to reach the server at a time.

For more information, see “Queuing Requests to the Cache” section.

Refresh a response before expiration

To ensure that a cached response is fresh whenever it is needed, the PREFETCH option refreshes a response before its calculated expiration time. The prefetch interval is calculated after receiving the first client request. From that point onward, the Citrix ADC appliance refreshes the cached response at a time interval that you configure in the PREFETCH parameter.

This setting is useful for data that is updated frequently between requests. It does not apply to negative responses (for example, 404 messages).

To configure prefetch for a content group by using the command line interface

At the command prompt, type:

set cache contentgroup <name> -prefetch YES [-prefetchPeriod <seconds> | -prefetchPeriodMilliSec <milliseconds>] [-prefetchMaxPending <positiveInteger>]

*To configure prefetch for a content group by using the GUI

Navigate to Optimization > Integrated Caching > Content Groups, and select the content group.

On Others tab, in the Flash Crowd and Prefetch group, select Prefetch option, and specify the values in Interval and Maximum number of pending prefetches text boxes.

Queue requests to the cache

The Flash Cache option queues requests that arrive simultaneously (a flash crowd), retrieves the response, and distributes it to all the clients whose requests are in the queue. If, during this process, the response becomes non-cacheable, the Citrix ADC appliance stops serving the response from the cache and instead serves the origin server’s response to the queued clients. If the response is not available, the clients receive an error message.

Flash Cache is disabled by default. You cannot enable Poll Every Time (PET) and Flash Cache on the same content group.

One disadvantage of Flash Cache is if the server replies with an error (for example, a 404 that is quickly remedied), the error is fanned out to the waiting clients.

Note: If Flash Cache is enabled, in some situations the Citrix ADC appliance is unable to correctly match the Accept-Encoding header in the client request with the Content-Encoding header in the response. The Citrix ADC appliance can assume that these headers match and mistakenly serve a hit. As a work-around, you can configure Integrated Caching policies to disallow serving hits to clients that do not have an appropriate Accept-Encoding header.

To enable Flash Cache by using the command line interface

At the command prompt, type:

set cache contentgroup <contentGroupName> -flashcache yes

To enable Flash Cache by using the GUI

Navigate to Optimization > Integrated Caching > Content Groups, and select the content group.

On Others tab, in the Flash Crowd and Prefetch group, select Prefetch option.

Cache a response after a client halts a download

You can set the Quick Abort parameter to continue caching a response, even if the client halts a request before the response is in the cache.

If the downloaded response size is less than or equal to the Quick Abort size, the Citrix ADC appliance stops downloading the response. If you set the Quick Abort parameter to 0, all downloads are halted.

To configure quick abort size by using the command line interface

At the command prompt, type:

set cache contentgroup <name> -quickAbortSize <integerInKBytes>

To configure quick abort size by using the GUI

  1. Navigate to Optimization > Integrated Caching > Content Groups, and select the content group.
  2. On Memory tab, set the relevant value in Quick Abort: Continue caching if more than text box.

Requiring a minimum number of server hits before caching

You can configure the minimum number of times that a response must be found on the origin server before it can be cached. You should consider increasing the minimum hits if the cache memory fills up quickly and has a lower-than-expected hit ratio.

The default value for the minimum number of hits is 0. This value caches the response after the first request.

To configure the minimum number of hits that are required before caching by using the command line interface

At the command prompt, type:

set cache contentgroup <name> -minhits <positiveInteger>

To configure the minimum number of hits that are required before caching by using the GUI

  1. Navigate to Optimization > Integrated Caching > Content Groups, and select the content group.
  2. On Memory tab, set the relevant value in Do not cache, if hits are less than text box.

Example for performance optimization

In this example, a client accesses a stock quote. Stock quotes are highly dynamic. You configure the integrated cache to serve the same stock quote to concurrent clients without sending multiple requests to the origin server. The stock quote expires after it is downloaded to all of the clients, and the next request for a quote for the same stock is fetched from the origin server. This ensures that the quote is always up to date.

The following task overview describes the steps to configure the cache for the stock quote application.

Configure caching for a stock quote application

Create a content group for stock quotes

For more information, see “About Content Groups.”

Configure the following for this content group:

  1. On the Expiry Method tab, select the Expire after complete response received check box.
  2. On the Others tab, select the Flash Cache check box, and click Create.
  3. Add a cache policy to cache the stock quotes.

For more information, see “Configuring a Policy in the Integrated Cache.”

Configure the following for the policy

  1. In the Action and Store in Group lists, select CACHE and select the group that you defined in the previous step.
  2. Click Add, and in the Add Expression dialog box configure an expression that identifies stock quote requests, for example: http.req.url.contains(“cgi-bin/stock-quote.pl”)
  3. Activate the policy.

For more information, see “Globally Binding an Integrated Caching Policy.” In this example, you bind this policy to request-time override processing and set the priority to a low value.

Improve cache performance