Product Documentation

Caching Support for Database Protocols

Sep 01, 2016

The integrated cache monitors database requests that flow through the Citrix® NetScaler® appliance and caches them as determined by the cache policies. Users have to configure the cache polices for MYSQL and MSSQL protocols, because the NetScaler does not provide any default policies for these protocols. When configuring the protocols, remember that request based policies currently support CACHE and INVAL actions, while response based policies currently support only NOCACHE action. After configuring the policies, bind them to virtual servers. MYSQL and MSSQL policies, both request and response, can be bound only to virtual servers

Before creating a cache policy, create a cache content group of type MYSQL or MSSQL. When you create a MYSQL or MSSQL cache content group, associate at least one hit selector with it. See "Setting Up a Basic Content Group" for setting up cache content groups.

The following example illustrates the procedure for configuring and verifying cache support for SQL protocols.

> enable feature IC 
> set cache parameter -memlimit 100 
> add cache selector sel1 mssql.req.query.text 
  
> add cache contentgroup cg1  -type "MSSQL" -hitselector "sel1" -invalselector "inval_sel" -relExpiry "500" -maxResSize 
 "100" 
> add cache policy cp1  -rule "mssql.req.query.command.contains(\"select\")" -action "CACHE" -storeInGroup "cg1" 
> add cache policy cp2  -invalObjects "cg1" -rule "mssql.req.query.text.contains(\"insert\")" -action "INVAL" 
> add db user user1  -password "Pass1" 
> add service svc_sql_1 10.102.147.70 mssql 64834 -healthMonitor "NO" -downstateflush "ENABLED" 
> add lb vserver lb_mssql1 mssql 10.102.147.77 1433  -lbmethod "roundrobin" 
> bind lb vserver lb_mssql1 svc_sql_1 
> bind lb vserver lb_mssql1 -policyName cp1  -type "REQUEST" -priority "2" 
> bind lb vserver lb_mssql1 -policyName cp2  -type "REQUEST" -priority "1"  
 
> show cache selector sel1 
     Name:sel1 
					Expressions: 
					1)mssql.req.query.text 
> show cache policy cp1 
					Name:cp1 
     Rule:mssql.req.query.command.contains("select") 
					CacheAction:CACHE 
					Stored in group: cg1 
					UndefAction:Use Global 
 				Hits:2 
					Undef Hits:0 
					Policy is bound to following entities 
					1) Bound to: 
								REQ VSERVER lb_mssql1 
								Priority:2 
								GotoPriorityExpression: END
Note: The methods for reducing flash crowds, as explained in "Reducing Flash Crowds", are not supported for MYSQL and MSSQL protocols.