Integrated caching
How integrated cache works
| Transaction Type | Specification |
|---|---|
| Cache Hit | Responses that the NetScaler appliance serves from the cache, including: Static objects, for example, image files and static webpages, 200 OK pages, 203 Non-Authoritative Response pages, 300 Multiple Choices pages, 301 Moved Permanently pages, 302 Found pages, 304 Not Modified pages, These responses are known as positive responses. The NetScaler appliance also caches the following negative responses: 307 Temporary Redirect pages, 403 Forbidden pages, 404 Not Found pages, 410 Gone pages. To further improve performance, you can configure the NetScaler appliance to cache more types of content. |
| Storable Cache Miss | For a storable cache miss, the NetScaler appliance fetches the response from the origin server, and stores the response in the cache before serving it to the client. |
| Non-Storable Cache Miss | A non-storable cache miss is inappropriate for caching. By default, any response that contains the following status codes is a non-storable cache miss: 201, 202, 204, 205, 206 status codes, All 4xx codes, except 403, 404 and 410, 5xx status codes |
How dynamic cache works
GET /mybugreportingsystem/mybugreport.dll?IssuePage&RecordId=31231&Template=view&TableId=1000
Host: mycompany.net
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
-
IssuePage
-
RecordID
-
Template
-
TableId
-
You configure a caching policy that looks for the string mybugreportingsystem and the GET method in HTTP requests. This policy directs matching requests to a content group for bugs.
-
In the content group for bugs, you configure a
hitselector that matches various parameter-value pairs, including IssuePage, RecordID, and so on.
GET /mybugreportingsystem/mybugreport.dll?IssuePage&RecordId=31231&Template=view&TableId=1000
GET /mybugreportingsystem/mybugreport.dll?IssuePage&Template=viewbtns&RecordId=31231&TableId=1000
GET /mybugreportingsystem/mybugreport.dll?IssuePage&Template=viewbody&RecordId=31231&tableid=1000
-
A request-time invalidation policy that looks for the string mybugreportingsystem and the POST HTTP request method, and directs matching requests to the content group for bug reports.
-
An invalidation selector for the content group for bug reports that expires cached content based on the RecordID parameter. This parameter appears in all the responses, so the invalidation selector can expire all relevant items in the cache.
POST /mybugreportingsystem/mybugreport.dll?TransitionForm HTTP/1.1\r\n
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) Opera 7.23 [en]\r\n
Host: mybugreportingsystem\r\n
Cookie:ttSearch.134=%23options%3Afalse%23active%23owner%3Afalse%23unowned%3Afalse%23submitter%3Afalse%23incsub%3Atrue;
Cookie2: $Version=1\r\n
. . .
\r\n
ProjectId=2&RecordId=31231&TableId=1000&TransitionId=1&Action=Update&CopyProjectId=0&ReloadForm=0&State=&RecordLockId=49873+issues+in+HTTP&F43. . .
-
Matches the request with an invalidation policy.
-
Finds the content group that is named in the policy.
-
Applies the invalidation selector for this content group and expires all responses that match RecordID=31231.
Configure integrated cache
-
An integrated cache license is required.
-
Obtain a license code from Citrix, go to the command line interface, and log in.
/nsconfig/license folder.
-
Reboot the NetScaler appliance by using the following command:
reboot
enable ns feature IC
Configure global attributes for caching
set cache parameter [-memLimit <MBytes>] [-via <string>] [-verifyUsing <criterion>] [-maxPostLen <positiveInteger>] [-prefetchMaxPending <positiveInteger>] [-enableBypass(YES|NO)] [-undefAction (NOCACHE|RESET)]
Enable integrated caching by NetScaler GUI
Configure global settings for caching by using the NetScaler GUI
Set up built-in content group, pattern set, and policies for Integrated Cache
| Integrated caching policy name | Policy rule |
|---|---|
| _cacheVPNStaticObjects | HTTP.REQ.URL.SET_TEXT_MODE(IGNORECASE).CONTAINS_INDEX("ctx_file_extensions").BETWEEN(101,150) |
| _cacheTCPVPNStaticObjects | HTTP.REQ.URL.ENDSWITH(".css") |
| _cacheOCVPNStaticObjects | HTTP.REQ.URL.ENDSWITH(".pdf") |
| _cacheWFStaticObjects | HTTP.REQ.URL.ENDSWITH(".js") |
| _mayNoCacheReq | HTTP.RES.HEADER("Content-Type").CONTAINS("application/x-javascript") |
| _noCacheRest | TRUE |
Flush cache configuration
flush cache contentgroup all
Example
0x00000089bae000000004 DEFAULT GET //1.1.1.1:80/html/index.html?name=hello
0x00000089bae000000005 DEFAULT GET //1.1.1.1:80/html/index.html?name=hi
Flush cache contentGroup all
done
`flush cache contentgroup <content group name>`
0x00000089bae000000004 DEFAULT GET //1.1.1.1:80/html/index.html?name=hello
0x00000089bae000000005 DEFAULT GET //1.1.1.1:80/html/index.html?name=hi
Flush cache ob -| 0x00000089bae000000004
done
`flush cache object (-locator <positive_integer> | (-url <URL> (-host <string> [-port <port>] [-groupName <string>] [-httpMethod ( GET | POST )])))`
0x00000089bae000000006 DEFAULT GET //1.1.1.1:80/html/index.html
flush cache ob -URL /html/index.html -host 1.1.1.1 -groupName DEFAULT
done
Flush cache configuration by using the NetScaler GUI
-
Navigate to Optimization > Content Groups.
-
In the Content Groups detailed pane, click Add.
-
In the Create Cache Content Groups page, set the following parameter under Others tab:
-
Flush Cache. Select the check box to flush the cache object.
-
-
Click Create and Close.
Configure integrated caching for various scenarios
set cache parameter -memlimit <value>
Integrated caching is enabled and cache memory limit is set to non-zero
Configuring by using the CLI
-
Display the cache parameter
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 500 MBytes
Memory usage limit (active value): 500 MBytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3: 18
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
-
Set a non-zero memory limit
set cache parameter -memlimit 600
-
Save the configuration
save config
-
From the shell prompt, run the following command to verify in the configuration file.
root@ns# cat /nsconfig/ns.conf | grep memLimit
-
Change the memory limit
set cache parameter -memLimit 600 -via NS-CACHE-9.3: 18 -verifyUsing HOSTNAME_AND_IP -maxPostLen 0 -enableBypass YES -undefAction NOCACHE
-
Reboot the appliance
root@ns# reboot
-
Verify the new value for the memory limit
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 600 MBytes
Memory usage limit (active value): 600 MBytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3: 18
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
Integrated caching is disabled and cache memory limit is set to non-zero
Configuring by using the CLI
-
Display the cache parameter
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 600 MBytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3: 18
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
-
Set a new memory limit
set cache parameter -memlimit 500
-
Save the configuration
save config
-
From the shell prompt, run the following command to verify in the configuration file
root@ns# cat /nsconfig/ns.conf | grep memLimit
-
Change the memory limit
set cache parameter -memLimit 500 -via NS-CACHE-9.3: 18 -verifyUsing HOSTNAME_AND_IP -maxPostLen 0 -enableBypass YES -undefAction NOCACHE
-
Verify the new value for the memory limit
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 500 MBytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3: 18
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
-
Enable the integrated caching feature
enable ns feature IC
-
Verify the new value for the memory limit
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 500 Mbytes
Memory usage limit (active value): 500 Mbytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3: 18
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
-
Save the configuration to ensure that the memory is automatically allocated to the feature when the appliance is restarted.
Integrated caching is enabled and cache memory is set to zero
Configuring by using the CLI
-
Verify the memory limits set in the ns.conf file from shell prompt
root@ns# cat ns.conf | grep memLimit
-
Change the memory limit
set cache parameter -memLimit 0 -via NS-CACHE-9.3: 18 -verifyUsing HOSTNAME_AND_IP -maxPostLen 4096 -enableBypass YES -undefAction NOCACHE
-
Verify the value for the memory limit
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 0 Mbytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3: 18
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
-
Set the memory limits to ensure the integrated caching feature caches objects
set cache parameter -memLimit 600
-
Verify the value for the memory limit
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 600 Mbytes
Memory usage limit (active value): 600 Mbytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3:
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
-
Save the configuration. Ensure that the memory is automatically allocated to the feature when the appliance is restarted.
-
Verify the memory limits set in the ns.conf file from shell prompt
root@ns# cat /nsconfig/ns.conf | grep memLimit
-
Change the memory limit
set cache parameter -memLimit 600 -via NS-CACHE-9.3: -verifyUsing HOSTNAME_AND_IP -maxPostLen 4096 -enableBypass YES -undefAction NOCACHE
Integrated caching is disabled and cache memory is set to zero
Configuring by using the CLI
-
Verify the memory limits set in the ns.conf file from shell prompt
root@ns# cat /nsconfig/ns.conf | grep memLimit
-
Change the memory limit
set cache parameter -memLimit 0 -via NS-CACHE-9.3: 18 -verifyUsing HOSTNAME_AND_IP -maxPostLen 4096 -enableBypass YES -undefAction NOCACHE
-
Verify the value for the memory limit
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 0 Mbytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3: 18
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
-
Enable the integrated caching feature
enable ns feature IC
-
Set the memory limits to ensure the integrated caching feature caches objects
set cache parameter -memLimit 500
-
Verify the value for the memory limit
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 500 Mbytes
Memory usage limit (active value): 500 Mbytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3:
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
-
Save the configuration
save config
-
Verify the memory limits set in the ns.conf file from shell prompt
root@ns# cat /nsconfig/ns.conf | grep memLimit
-
Change the memory limit
set cache parameter -memLimit 500 -via NS-CACHE-9.3: 18 -verifyUsing HOSTNAME_AND_IP -maxPostLen 4096 -enableBypass YES -undefAction NOCACHE