Product Documentation

Integrated Caching

Apr 26, 2017

Content Groups

How is a DEFAULT content group different from other content groups?
The behavior of the DEFAULT content group is exactly the same as any other group. The only attribute that makes the DEFAULT content group special is that if an object is being cached and no content group has been created, the object is cached in the DEFAULT group.
What is the 'cache-Control' option of the content group level?
You can send any cache-control header the browser. There is a content group level option, -cacheControl, which enables you to specify the cache-control header that you want to be inserted in the response to the browser.
What is the 'Minhit' option in content group level?
Minhit is an integer value specifying the minimum number of hits to a cache policy before the object is cached. This value is configurable at the content group level. Following is the syntax to configure this value from the command line interface.
add/set cache contentGroup <Content_Group_Name> [-minHits <Integer>]
What is the use of the expireAtLastByte option?

The expireAtLastByte option enables the integrated cache to expire the object as soon as it has been downloaded. Only requests that are outstanding requests at that time are served from cache. any new requests are sent to the server. This setting is useful when the object is frequently modified, as in the case of stock quotes. This expiry mechanism works along with the Flash Cache feature. To configure expireAtLastByte option, run the following command from the command line interface:

add cache contentGroup <Group_Name> –expireAtLastByte YES

Cache policy

What is a caching policy?
Policies determine which transactions are cacheable and which are not. Additionally, policies add or override the standard HTTP caching behavior. Policies determine an action, such as CACHE or NOCACHE, depending on the specific characteristics of the request or response. If a response matches policy rules, the object in the response is added to the content group configured in the policy. If you have not configured a content group, the object is added to the DEFAULT content group.
What is a policy hit?
A hit occurs when a request or response matches a cache policy.
What is a miss?
A miss occurs when a request or response does not match any cache policy. A miss can also occur if the request or response matches a cache policy but some override of RFC behavior prevents the object from being stored in the cache.
I have configured Integrated Caching feature of the NetScaler appliance. When adding the following policy, an error message appears. Is there any error in the command?
add cache policy image_caching -rule exp1 | ns_ext_not_jpeg –action cache
> ERROR: No such command
In the preceding command, the expression should be within the quotation marks. Without quotation marks, the operator is considered to be the pipe operator.

Memory Requirements

What are the commands that I can run on the NetScaler appliance to check the memory allocated to cache?
To display the memory allocated for cache in the NetScaler appliance, run any of the following commands from the command line interface:
  • show cache parameter

    In the output, check the value of the Memory usage limit parameter. This is the maximum memory allocated for cache.

  • show cache <Content_Group_Name>

    In the output, check the values of the Memory usage and Memory usage limit parameters indicating the memory used and allocated for the individual content group.

My NetScaler appliance has 2 GB of memory. Is there any recommended memory limit for cache?

For any model of the NetScaler appliance, you can allocate half of the memory to the cache. However, Citrix recommends allocating a little less than half of the memory, because of internal memory dependency. You can run the following command to allocate 1 GB of memory to cache:

set cache parameter -memLimit 1024

Is it possible to allocate memory for individual content groups?
Yes. Even though you allocate memory for the integrated cache globally by running the set cache parameter –memlimit<Integer>, you can allocate memory to individual content groups by running the set cache <Content_Group_Name> –memLimit <Integer> command. The maximum memory you can allocate to content groups (combined) cannot exceed the memory you have allocated to the integrated cache.
What is the dependency of memory between integrated cache and TCP buffer?
If the NetScaler appliance has 2 GB memory, then the appliance reserves approximately 800 to 900 MB of memory and remaining is allocated to FreeBSD operating system. Therefore, you can allocate up to 512 MB of memory to integrated cache and the rest is allocated to TCP buffer.
Does it affect the caching process if I do not allocate global memory to the integrated cache?
If you do not allocate memory to integrated cache, all requests are sent to the server. To make sure that you have allocated memory to the integrated cache, run the show cache parameter command. Actually no objects will be cached if global memory is 0, so this needs to be set first.

Verification commands

What are the options for displaying cache statistics?
You can use either of the following options to display the statistics for cache:
  • stat cache

    To display the summary of the cache statistics.

  • stat cache –detail

    To display the full details of the cache statistics.

What are the options for displaying the cached content?
To display the cached content, you can run the show cache object command.
What is the command that I can run to display the characteristics of an object stored in cache?

If the object stored in the cache is, for example, GET //, you can display the details about the object by running the following command from the command line interface of the appliance:

show cache object -url '/index.html' -host -port 80

Is it mandatory to specify the group name as a parameter to display the parameterized objects in cache?
Yes. It is mandatory to specify the group name as a parameter to display the parameterized objects in cache. For example, consider that you have added the following policies with the same rule:
add cache policy p2 -rule ns_url_path_cgibin -action CACHE –storeInGroup g1 
add cache policy p1 -rule ns_url_path_cgibin -action CACHE -storeInGroup g2

In this case, for the multiple requests, if policy p1 is evaluated, its hit counter is incremented and the policy stores the object in the g1 group, which has hit parameters. Therefore, you have to run the following command to display the objects from the cache:

show cache object -url "/cgi-bin/" -host groupName g1

Similarly, for another set of multiple requests, if policy p2 is evaluated, its hit counter is incremented and the policy stores the object in the g2 group, which does not have hit parameters. Therefore, you have to run the following command to display the objects from the cache:

show cache object -url "/cgi-bin/" -host

I notice that there are some blank entries in the output of the nscachemgr command. What are those entries?
Consider the following sample output of the nscachemgr command. The blank entries in this output are highlighted in bold face for your reference:
root@ns# /netscaler/nscachemgr -a 
Total URLs in IC = 10
The blank entries in the output are due to the default caching properties for GET / HTTP/1.1.

Flushing Objects

How can I flush a selective object from the cache?
You can identify an object uniquely by its complete URL. To flush such object, you can perform any of the following tasks:
  • Flush cache
  • Flush content group
  • Flush the specific object
To flush the specific object, you have to specify the query parameters. You specify the invalParam parameter to flush the object. This parameter applies only to a query.
Does any change in the cache configuration trigger flushing of cache?
Yes. When you make any changes to the cache configuration, all the SET cache commands inherently flush the appropriate content groups.
I have updated the objects on the server. Do I need to flush the cached objects?
Yes. When you update objects on the server, you must flush the cached objects, or at least the relevant objects and content groups. The integrated cache is not affected by an update to the server. It continues to serve the cached objects until they expire.

Flash Cache

What is Flash Cache feature of the NetScaler appliance?
The phenomenon of Flash crowds occurs when a large number of clients access the same content. The result is a sudden surge in traffic toward the server. The Flash Cache feature enables the NetScaler appliance to improve performance in such situation by sending only one request to the server. All other requests are queued on the appliance and the single response is served to all of the requests. You can use either of the following commands to enable the Fast Cache feature:
  • add cache contentGroup <Group_Name> -flashCache YES
  • set cache contentGroup <Group_Name> -flashCache YES
What is the limit for Flash Cache clients?
The number of Flash Cache clients depends on the availability of resources on the NetScaler appliance.

Default Behaviour

Does the NetScaler appliance proactively receive objects upon expiry?
The NetScaler appliance never proactively receives objects on expiry. This is true even for the negative objects. The first access after expiry triggers a request to the server.
Does the integrated cache add clients to the queue for serving even before it starts receiving the response?
Yes. The integrated cache adds clients to the queue for serving even before it starts receiving the response.
What is the default value for the Verify cached object using parameter of the cache configuration?
HOSTNAME_AND_IP is the default value.
Does the NetScaler appliance create log entries in the log files?
Yes. The NetScaler appliance creates log entries in the log files.
Are compressed objects stored in the cache?
Yes. Compressed objects are stored in the cache.

Interoperability with other features

What happens to objects that are currently stored in cache and are being accessed though SSL VPN?
Objects stored in the cache and accessed regularly are served as cache hits when accessed through SSL VPN.
What happens to objects stored in the cache when accessed through SSL VPN and later accessed through a regular connection?
The objects stored through the SSL VPN access are served as a hit when accessed through the regular connection.
When using weblogging, how do I differentiate entries that indicate response served from cache from those served by the server?

For responses served from the integrated cache, the server log field contains the value IC. For responses served from a server, the server log field contains the value sent by the server. Following is a sample log entry for an integrated caching transaction:

" - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 4.0; .NET CLR 1.0.3705)" "GET /" 200 0 "IC""

Along with a client request, the response logged is the one sent to the client and not necessarily the one sent by the server.


What do you mean by configuring relexpiry and absexpiry?
By configuring relexpiry and absexpiry, it means that you are overriding the header irrespective of what appears in the header. You can configure different expiry setting and the content group level. With relexpiry, expiration of the header is based on the time at which the object was received by the NetScaler. With absexpiry, expiration is based on the time configured on the NetScaler. Relexpiry is configured in terms of seconds. Absexpiry is a time of day.
What do you mean by configuring weakpos and heuristic?
The weakpos and heuristic are like fall back values. If there is an expiry header, it is considered only if the last-modified header is present. The NetScaler appliance sets expiry on the basis of the last-modified header and the heuristic parameter. The heuristic expiry calculation determines the time to expiry by checking the last-modified header. Some percentage of the duration since the object was last modified is used as time to expiry. The heuristic of an object that remains unmodified for longer periods of time and is likely to have longer expiry periods. The –heurExpiryParam specifies what percentage value to use in this calculation. Otherwise, the appliance uses the weakpos value.
What should I consider before configuring dynamic caching?
If there is some parameter that is in name-value form and does not have the full URL query, or the appliance receives the parameter in a cookie header or POST body, consider configuring dynamic caching. To configure dynamic caching, you have to configure hitParams parameter.
How is hexadecimal encoding supported in the parameter names?
On the NetScaler appliance, the %HEXHEX encoding is supported in the parameter names. In the names that you specify for hitParams or invalParams, you can specify a name that contains %HEXHEX encoding in the names. For example, name, nam%65, and n%61m%65 are equivalent.
What is the process for selecting a hitParam parameter?
Consider the following excerpt of an HTTP header for a POST request:
How do we select a hitparam? 
POST /data2html.asp?param1=value1&param2=&param3&param4=value4  
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,  
application/, application/,  
application/msword, application/x-shockwave-flash, */* 
Accept-Language: en-us 
Content-Type: application/x-www-form-urlencoded 
Accept-Encoding: gzip, deflate 
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) 
Content-Length: 153 
Connection: Keep-Alive 
Cache-Control: no-cache 
In the above request, you can use S1 and B1, highlighted in bold face for your reference, as hitParams depending on your requirements. Additionally, if you use -matchCookies YES in the ASPSESSIONIDQGQGGRNY content group, then you can also use these parameters as hitParams.
What happens to the queued clients if the response is not cacheable?
If the response is not cacheable, all of the clients in the queue receive the same response that the first client receives.
Can I enable the Poll every time (PET) and Flash Cache features on the same content group?

No. You cannot enable PET and Flash Cache on the same content group. The integrated cache does not perform AutoPET function on Flash Cache content groups. The PET feature ensures that the integrated cache does not serve a stored object without consulting the server. You can configure PET explicitly for a content group.

When are the log entries created for the queued clients?
The log entries are created for the queued clients soon after the appliance receives the response header. The log entries are created only if the response header does not make the object non-cacheable.
What is the meaning of the DNS, HOSTNAME, and HOSTNAME_AND_IP values of the Verify cached object using parameter of the cache configuration?
The meanings are as follows:
  • set cache parameter -verifyUsing HOSTNAME

    This ignores the destination IP address.

  • set cache parameter -verifyUsing HOSTNAME_AND_IP

    This matches the destination IP address.

  • set cache parameter -verifyUsing DNS

    This uses the DNS server.

I have set weakNegRelExpiry to 600, which is 10 minutes. I noticed that 404 responses are not getting cached. What is the reason ?

This completely depends on your configuration. By default, 404 responses are cached for 10 minutes. If you want all 404 responses to be fetched form the server, specify–weakNegRelExpiry 0. You can fine tune the –weakNegRelExpiry to a desired value, such as higher or lower to get the 404 responses cached appropriately. If you have configured –absExpiry for positive responses, then it might not yield desired results.

When the user accesses the site by using the Mozilla Firefox browser, the updated content is served. However, when the user accesses the site by using the Microsoft Internet Explorer browser, stale content is served. What could be the reason?

The Microsoft Internet Explorer browser might be taking the content from its local cache instead of the NetScaler integrated cache. The reason could be that the Microsoft Internet Explorer browser is not respecting the expiry related header in the response.

To resolve this issue, you can disable the local cache of the Internet Explorer and clear the offline content. After clearing the offline content, the browser should display the updated content

What if Hits are zero?

Check to see if the server time and NS time are in sync. And the weakPosrelexpiry limit set should bear the time difference between NS and server as shown below

root@ns180# date

Tue May 15 18:53:52 IST 2012

Why are policies getting hits but nothing is being cached?
Verify that memory is allocated to the integrated cache and that the allocation is greater than zero.
Is it possible to zero the cache counters?
There is no command line or GUI option for setting the cache counters to zero, and flushing the cache does not do so either. Rebooting the box automatically sets these counters to zero.