NCache 4.4 - Online Documentation

Cache Config

 
Cache configuration file contains information regarding all registered caches/clusters. It is installed with NCache and is located at "%Install Directory%/NCache/config". Modules that need to read the configurations first try to find config.ncconf in application folder i.e. along side web.config. If config.ncconf is not found in application folder, it then reads the configuration from installation folder.
 
config.ncconf file is explained below:
 
<!--
Configuration file (config.ncconf) contains the details of all the registered caches. All caches configurations are enclosed in <configuration></configuration> tag. Whereas each cache detail is enclosed in <cache-config></cache-config>.
-->
 
<cache-config name="cachepor" inproc="False" config-id="0" last-modified="" type="local-cache" auto-start ="True|False">
 
Name: Is the cache identifier. Cache will be known by whatever name you will specify here. This is the same name as you specify while initializing cache.
Inproc: Determine whether the cache will run as in-proc (in your application process) or out-proc (in NCache Service process). If set to "False" cache will run as out-proc or if set to "True" then cache will run as in-proc.
Config-id: Is used to determine whether the configuration is modified or not.
Last-modifed: Contains information related to last modification in cache configuration.
Type: Specifies whether the cache is clustered or local cache. This attribute can any of the following:
 
  • "clustered-cache" means the cache is any of the clustered cache type. i.e; Partition of Replica, Replicated, Partitioned and Mirror.
  • "local-cache" means the cache is a stand-alone cache.
  • "client-cache" means the cache a Local Cache connected to a Clustered Cache.
 
Auto-Start: This xml tag specifies the auto start status of cache.
 
<log enabled="True" trace-errors="True" trace-notices="False" trace-warnings="False" trace-debug="False"/>
 
NCache maintains a log file to write traces for information and debugging purpose.  NCache is providing different type of traces as shown in the above xml tag. Using these tags user can enable\disable the various traces. By default only “Error” trace is enabled, rest of the traces are disabled. Error trace does not affect the cache performance but for other traces we recommend not to enable them in a production environment as they affect the performance of NCache. Here log files for each cache will be created  at "%Install Directory%/NCache/log-files" location which contains information related to the enabled traces.
 
<perf-counters enabled="True"/>
 
Using this xml tag you can enable/disable the publishing of data as perfmon counters:
 
Enabled: If this attribute is set to "True" NCache will updated the published perfmon counters. If set to "False" then Ncache will not update any of the published perfmon counter.
 
<replication-strategy synchronous="False"/>
 
In case of Partition of Replica the you will find this tag in cache configuration. Replication strategy defines how data is replicated to backup node.
 
Synchronous: This attribute can be set to True/False. If set to "False" then data operation will be replicated asynchronously on the backup node. If set to "True" then data operation will be replicated synchronously on the backup node.
 
<compression enabled="False" threshold="500kb"/>
 
This xml tag specifies whether the items greater then specified threshold should be compressed/decompressed at client side.
 
Enabled: To enable compression set this attribute to "True" otherwise set it to "False"
Threshold: Item greater than the value specified in threshold attribute will only be compressed/decompressed at client side if compression is enabled.
 
As per above mentioned compression tag example only item greater than 100kb of size will be compressed/decompressed at client side.
 
<notifications item-remove="False" item-add="False" item-update="False" cache-clear="False"/>
 
Notification xml tag specifies the registered event with Cache.
 
Item-add: This attribute can be set to "True" or "False". If set to "True" will notify when an item is added to the cache and similarly if set to "False" no notification will be fired if item is added in cache.
Item-remove: This attribute can be set to "True" or "False". If set to "True" will notify when an item is removed from the cache and similarly if set to "False" no notification will be fired if item is removed in cache.
Item-update: This attribute can be set to "True" or "False". If set to "True" will notify when an item is updated in the cache and similarly if set to "False" no notification will be fired if item is updated in cache.
Item-clear: This attribute can be set to "True" or "False". If set to "True" will notify when cache is cleared and similarly if set to "False" no notification will be fired if the cache is cleared.
 
<cleanup interval="15sec"/>
 
Cleanup xml tag specify the periodic interval after which item for expiration will be checked:
Interval: attribute specify the periodic clean up interval. If set to "15sec" this means the expiration check will be performed after every 15sec.
 
<storage type="heap" cache-size="250mb"/>
 
Storage xml tag specifies the storage related details for cache:
 
Type: this attribute can only be set to "heap" as currently ncache only supports heap based storage.
Cache-size: this attribute specifies the upper limit of cache size in MB.
 
<eviction-policy enabled="True" default-priority="normal" policy="priority" eviction-ratio="5%"/>
 
This xml tag specifies whether to perform the eviction or not. If eviction is enabled then cache will remove the existing item to accommodate new ones. Exiting items will be removed based on eviction strategy.
 
Enabled: To enable eviction set this attribute to "True" otherwise set it to "False"
 
Policy: attribute the eviction policy to be used. Eviction policy can be one of the following:
  • Lru (Least recently used)
  • Lfu (Least frequently used)
  • Priority based
 
Default-priority: specifies default priority that is associated with an item if no priority is specified for that item. This attribute can be set to following:
  • High
  • Above-normal
  • Normal
  • Below-normal
  • Low
 
This is only applicable in case of priority based eviction.
 
Eviction-ratio: specifies how much percentage of data should be evicted when eviction is performed.
 
<cluster topology="partition-replica" op-timeout="60sec" stats-repl-interval="60sec" use-heart-beat="False">
 
This xml tag is used for specifying the in-cluster communication details, it also contains a sub tag, channel, which further defines the communication details of the cluster:
Please Note, this tag will not be present in Local Cache.
 
Topology: Specifies which topology does the cluster follow, it can be either one of the following as provided by NCache
  • Partition Replica Topology
  • Replicated Topology
  • Partitioned Topology
  • Mirror Topology
 
Op-timeout: (Operation Time Out) Determines the timeout of a connection among the servers if a server in the cluster fails to respond
Stats-repl-interval: (Statistics Replication Interval) the interval provided to the cluster at which to synchronize their information among its servers
Use-heart-beat: Heart Beat is used to monitor the connectivity between nodes
Active-mirror-node: in Mirror topology, only two server nodes are allowed, of which one is active i.e. the one which handles all the request made by the client, here the ip of the active node is provided
 
<channel tcp-port="8011" port-range="2" connection-retries="0" connection-retry-interval="0secs" initial-hosts="sanfransisco[8011],sanramon[8011]" num-initial-hosts="2"/>
 
Channel xml tag specifies the details of port connectivity and and other communication options among the cluster servers:
 
Tcp-port: connection is channeled through a TCP port, this value defines the port which it occupies
Port-range: when initializing, if the port provided is taken by some other application then it will try to establish its connection on port incremented by 1, for this the range is provided i.e. to what range should it search for an available TCP port
Connection-retries: if connection among the node(s) is failed, then this defines how many retries should be done to consider it a permanent faliure
Connection-retry-interval: the interval between connection retries is defined in this value
Initial-hosts: Specifies the server IPs making up the cluster and with their starting port number
Num-initial-hosts: (Number of Initial Hosts) specifies the number of Server Nodes
 
<alerts>
<email-notification email-notification-enabled="False" sender="" smtp-server="" smtp-port="0" ssl="False" authentication="False" sender-login="" sender-password=""/>
<alerts-types cache-stop="False" cache-start="False" node-left="False" node-joined="False" state-transfer-started="False" state-transfer-stop="False" state-transfer-error="False" cache-size="False"/>
</alerts>
 
If Event notifications through email is required then information for its setup is configured here:
 
Email-notification: contains all the information related to the email address
Email-notification-enabled: enables notification through email
Sender : specify the email account from whom the email notifications are sent
Smtp -server: specify the gateway to send email notifications
Smtp -port: The port number used to forward emails
SSL : (Secure Socket Layer) To enable SSL security
Authentication : If any authentication is required, this is to be True
Sender-login : if Authentication is required, specify the login name
Sender-password : Authentication password is entered here
Alert-Types: Specifies at which event an automated email is to be generated
Cache-stop : if the cache is stopped at any moment
Cache-start : at start of cache, email notification is generated
Node-left : when a server node leaves the cluster or if a server node is inaccessible for any reason, email notification will be sent if this is enabled
Node-joined : At joining of any server node
State-Transfer - started : To notify whenever a state transfer is occurred which happens when Load balancing is performed
Cache-size : whenever cache size is changed (Hot Apply-able)
 
<sql-dependency use-default="False"/>
 
This xml tag specifies the queuing and service SQL notification architecture.
 
Use-default: The attribute can be set to True/False. If the attribute is set to "True" then default SQL Dependency service and queue will be created at run time. If the attribute is set to "False" then the custom define SQL Dependency service and queue will be created and used by NCache.
 
 
See Also