Cache Config (config.ncconf)
The cache configuration file contains information regarding all the registered caches/clusters. Modules that need to read the configurations first try to find config.ncconf in the application folder, i.e., alongside the Web.config. If config.ncconf is not found in the application folder, it then reads the configuration from the installation folder.
Note
This file is installed with NCache and is located at %NCHOME%\config
in Windows and /opt/ncache/config
in Linux.
Cache Config Syntax
The cache configuration file is explained below.
<!--
The configuration file (config.ncconf) contains the details of all the registered caches. All cache configurations are enclosed in the <configuration></configuration> tag. Whereas each cache detail is enclosed in <cache-config></cache-config>.
-->
<cache-config cache-name="demoCache" store-type="Distributed-Cache" environment="" config-id="6a49d9ce-9aa7-4312-ada6-4fec37a6e729" config-version="0">
<cache-settings inproc="False" last-modified="" auto-start="False" data-format="Serialized" serialization="Json">
...
</cache-settings>
</cache-config>
Understanding the Cache Config Tags
The following section explains the tags mentioned as part of the file syntax.
This tag defines essential cache settings. cache-name:
Specifies the cache name here. This is the same name as you specify while initializing the cache. store-type:
Specifies the purpose for which this cache will be used. Can have one of the following possible values: config-id:
Auto-generates unique Id for the modified configuration. config-version:
Used to determine whether the configuration is modified or not. environment: Specifies the cache's deployment e.g., Development, Production, and QA. This tag configures cache operation and execution. inproc:
Determines whether the cache will run as InProc (in your application process) or OutProc (in the NCache Service process). If set to False, the cache will run as OutProc and, if set to True, the cache will run as InProc. The default value is last-modified:
Contains information related to the last modification in the cache configuration. auto-start:
Enables the auto start of cache on cache startup. The default value is data-format:
The format with which data is stored in cache, can be Serialized or Object. The default value is serialization:
Determines the serialization format for the cache. It can be either JSON or Binary. The default value is NCache maintains a log file to write traces for information and debugging purposes. The user can enable or disable the various traces using these tags. By default, only the enable-logs:
Allows you to maintain a log file by specifying a Boolean value. By default, it is trace-errors:
Logs error traces, essential for identifying and troubleshooting critical issues. By default, it is trace-notices:
Logs notice traces for general informational messages. By default, it is trace-warnings:
Logs warning traces, useful for detecting and addressing potential issues. By default, it is trace-debug:
Logs detailed debug traces, helpful for diagnosing problems and analyzing system behavior during development or testing. By default, it is log-path:
By default, log files for each cache are created at When configured, NCache will update the published PerfMon counters. enable-counters:
When set to True, NCache will update the published PerfMon counters. If set to False, NCache will not update any of the published PerfMon counters. By default, it is snmp-port: It enables SNMP-based monitoring and defines the port through which SNMP data can be communicated. This tag allows you to automatically trigger data load balancing on nodes in a partitioned cluster. enabled:
Specifies whether to enable data load balancing. By default, its value is auto-balancing-threshold:
Specifies the percentage data size above the average data size per node that triggers automatic load balancing when exceeded. By default, it is auto-balancing-interval:
Specifies the interval after which auto-balancing takes place. By default, it is This tag specifies whether the items greater than the specified threshold should be compressed/decompressed on the client-side. enable-compression:
To enable compression, set this attribute to True, otherwise, by default it is threshold:
Items greater than the value specified in the threshold attribute will only be compressed/decompressed on the client-side if compression is enabled. As per above mentioned compression tag example, only items greater than 100kb in size will be compressed/decompressed on the client-side. This tag enables batching several instructions over a TCP connection, reducing network cost and enhancing performance by sending bulk commands at specified intervals. enabled:
When set to True, pipelining allows clients to send multiple requests in a batch using a single TCP connection for better performance. By default it is batch-interval:
Specifies the interval for sending batched operations over the network. By default, it is This tag allows the server to monitor if a client is disconnected from all cache servers in a clustered cache. enable:
Specifies whether client death detection is enabled or not. The default value is grace-interval:
It is the interval the server waits before determining that a disconnected client is dead and freeing up its resources. The default value is This tag enables client connection\disconnection event notifications in a clustered cache environment. In order to avoid unnecessary disconnect notifications during brief network issues, a retention-period is also configured. enabled:
Enable this option to allow clients to receive notifications if another client connects or disconnects. By default it is retention-period:
The time interval after which a disconnected client is considered as disconnected. By default, it's valuse is The cache-notifications tag specifies the registered event with the cache. All the flags in this tag are marked Item-add:
This attribute can be set to True or False. If set to True, it will notify users when an item is added to the cache. Similarly if set to False, no notification will be fired if the item is added to the cache. Item-remove:
This attribute can be set to True or False. If set to True, it will notify users when an item is removed from the cache. Similarly if set to False, no notification will be fired if the item is removed from the cache. Item-update:
This attribute can be set to True or False. If set to True, it will notify users when an item is updated in the cache. Similarly if set to False, no notification will be fired if the item is updated in the cache. expiration-time:
This attribute specifies the expiration time for the cache notifications, it is the interval after which the item for expiration will be checked. By default, its value is This tag periodically removes items from cache. This 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. The default value is This tag specifies whether to perform the eviction or not. enabled-eviction:
If eviction is set to True then the cache will remove the existing item to accommodate new ones. Exiting items will be removed based on the eviction strategy. By default it is default-priority: Specifies the default priority that is associated with an item if no priority is specified for that item. This attribute can be set to the following: This is only applicable in case of priority based eviction. policy:
This attribute specifies the eviction policy to be used. Eviction policy can be one of the following: eviction-ratio:
Specifies how much percentage of data should be evicted when eviction is performed. This tag specifies the basis under which the cache entries will expire and be removed from the cache. This tag will specify the exact time the cache entries will expire and be removed. longer-enabled: Specifies whether longer expiration is enabled. If True, the value should be provided. longer-value: If set to True, this value will be used for expiration. default-enabled: Specifies whether default expiration is enabled. If True, the value should be provided as well. default-value: If set to True, this value will be used for expiration. This tag helps you retain items in the cache by extending the accessed item’s lifespan by a specific interval of time. longer-enabled: Specifies whether longer expiration is enabled. If True, the value should be provided. longer-value: If set to True, this value will be used for expiration. default-enabled: Specifies whether default expiration is enabled. If True, the value should be provided as well. default-value: If set to True, this value will be used for expiration. This tag is used to when encryption is enabled. enable-encryption: Specifies whether encryption is enabled or not. key: Specifies the key used to encrypt or decrypt data. provider: Specifies the encryption algorithm and key size. This tag is used for specifying the cluster topology, it also contains a subtag, which further defines the communication details of the cluster. Please note, that this tag will not be present in Local Cache. topology:
Specifies which topology the cluster follows, it can be either one of the following as provided by NCache: This tag manages cluster connectivity to monitor node connections. operation-timeout:
Determines the timeout of a connection among the servers if a server in the cluster fails to respond. The default value is stats-repl-interval:
Specifies the interval provided to the cluster at which to synchronize their information among its servers. The default value is use-heart-beat:
HeartBeat is used to monitor the connectivity between nodes. The default value is In the case of Partition-Replica, you will find this tag in the cache configuration. This tag defines how data is replicated to the backup node. This tag specifies the details of port connectivity and other communication options among the cluster servers: cluster-port:
Connection is channeled through a TCP port; this value defines the port which it occupies. The default value is 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 made to consider it a permanent failure. The default value is connection-retry-interval:
The interval between connection retries is defined in this value. The default value is join_retry_count:
Specifies the number of attempts a node makes to join the cluster. By default, it is join_retry_timeout:
Specifies the time interval a node will wait before attempting to reconnect with other nodes in the cluster. The default value is This tag when enabled, detects possible cluster split-brain issues. It is only in Partition-Replica topology. enable:
This flag is used to enable the Split-Brain Recovery feature. By default, its value is detection-interval:
It refers to the configuration and setup of cache instances across servers. This tag is used to determine the settings of your Distributed Cache with Persistence. It only appears if you've set your store-type as distributed-cache-persistence. It has the following parameters: This tag configures the persistence provider for the distributed cache. provider-type:
This parameter indicates the type of persistence provider you are using in your distributed-cache-persistence. It has value ncache-persistence. connection-string:
Specifies a valid connection string that determines the connection with the provider type. This tag configures the operational parameters for data persistence. persistence-interval:
Specifies the interval after which the operations present in the persistence queue are applied to the persistence store. By default, it is persistence-retries:
Specifies the number of retries in case of persistence batch failures after which the persistence-interval is shifted to persistence-interval-longer. The default value is persistence-interval-longer:
When several consecutive failures reach persistence-retries, the interval is then set to persistence-interval-longer. If event notifications through email are required, then information for its setup is configured as follows. This tag contains all the information related to the email address. email-notification:
Enables notification through email. By default it is sender:
Specify the email account from whom the email notifications are sent. smtp-server:
Specify the gateway to send email notifications. tls: Enables Transport Layer Security for secure encrypted email transmission. smtp-port:
The port number used to forward emails. authentication:
If any authentication is required, this is to be True. By default it is sender-login:
If Authentication is required, specify the login name. sender-password:
The authentication password is entered here. security-protocol: Specifies which TLS version should be used for secure email communication in NCache alerts. This tag specifies at which event an automated email is to be generated. By default all values are cache-stop:
If the cache is stopped at any moment, an email notification is generated. cache-start:
If the cache is started, an email notification is generated. node-left:
When a server node leaves the cluster or if a server node is inaccessible for any reason, an email notification will be sent if this is enabled. node-joined:
At the joining of any server node, an email notification is generated. state-transfer-started:
When enabled, this tag initiates email alerts to notify customers whenever the state transfer process is started. state-transfer-stop:
When enabled, this tag initiates email alerts to notify customers whenever the state transfer process is stopped. cache-size: When set to True, an email notification is generated whenever cache size is changed during runtime. partial-connectivity-detected: When set to True, it triggers an email alert when one or more cache nodes experience limited or broken connectivity with others, indicating a possible network partition or communication issue within the cluster.<cache-config cache-name="demoCache" store-type="Distributed-Cache" environment="" config-id="6a49d9ce-9aa7-4312-ada6-4fec37a6e729" config-version="0">
<cache-settings>
<cache-settings inproc="False" last-modified="" auto-start="False" data-format="Serialized" serialization="Binary">
False
.False
.Serialized
.Binary
. <logging>
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 enabling them in a production environment as they affect the performance of NCache.<logging enable-logs="True" trace-errors="True" trace-notices="False" trace-warnings="False" trace-debug="False" log-path=""/>
False
as logging can create an overhead and degrade application performance.True
.False
.False
.False
.%NCHOME%\config
in Windows and /opt/ncache/config
in Linux. However, you can specify a custom path if you want to save the logs elsewhere. <performance-counters>
<performance-counters enable-counters="True" snmp-port="0"/>
True
. <data-load-balancing>
<data-load-balancing enabled="False" auto-balancing-threshold="60%" auto-balancing-interval="30sec"/>
False
.60%.
30 seconds
. <compression>
<compression enable-compression="False" threshold="100kb"/>
False
. <pipelining>
<pipelining enabled="True" batch-interval="250usec"/>
False
.250 µs
, the minimum value is 50µs and the maximum value is 5000µs. <client-death-detection>
<client-death-detection enable="False" grace-interval="60sec"/>
False
.60 seconds
and can be extended up to 180 seconds. <client-activity-notification>
<client-activity-notification enabled="False" retention-period="5sec"/>
False
.5 seconds
. <cache-notifications>
False
by default.<cache-notifications item-remove="False" item-add="False" item-update="False" expiration-time="15sec"/>
15 seconds
. <cleanup>
<cleanup interval="15sec"/>
15 seconds
. <storage>
<storage type="heap" cache-size="1024mb"/>
1024 MB
. <eviction-policy>
<eviction-policy enabled-eviction="True" default-priority="normal" policy="lru" eviction-ratio="5%"/>
False
.
<expiration-policy>
<expiration-policy enabled="False">
<absolute-expiration longer-enabled="False" longer-value="0" default-enabled="False" default-value="0"/>
<sliding-expiration longer-enabled="False" longer-value="0" default-enabled="False" default-value="0"/>
</expiration-policy>
False
. <absolute-expiration>
<absolute-expiration longer-enabled="False" longer-value="0" default-enabled="False" default-value="0"/>
<sliding-expiration>
<sliding-expiration longer-enabled="False" longer-value="0" default-enabled="False" default-value="0"/>
<encryption>
<encryption enable-encryption="True" key="AJtBe83Cy1og5ZjeWg5YxwqN3Q0ZFGng6z5hM5zA02o=" provider="AES 256"/>
<cache-topology>
<cache-topology topology="partitioned-replica">
<cluster-settings operation-timeout="60sec" stats-repl-interval="2sec" use-heart-beat="False">
...
</cluster-settings>
</cache-topology>
<cluster-settings>
<cluster-settings operation-timeout="60sec" stats-repl-interval="2sec" use-heart-beat="False">
60 seconds
.2 seconds
.True
. <data-replication>
<data-replication synchronous="False"/>
<cluster-connection-settings>
<cluster-connection-settings cluster-port="7806" port-range="1" connection-retries="2" connection-retry-interval="2secs" join_retry_count="24" join_retry_timeout="5"/>
7806
.2
.2 seconds
.24
times.5
. <split-brain-recovery>
<split-brain-recovery enable="False" detection-interval="60"/>
False
.detection-interval
is the period interval after which the cluster will detect for split-brain condition. <cache-deployment>
<cache-deployment deployment-version="5">
<data-persistence>
<data-persistence store-name="demoPersistenceCache_db">
<provider-settings provider-type="ncache-persistence" connection-string="lxxKK7Xqh0Tpm3rPvPOmYcCRYyeUV8f8NswyNRFum/uA0HXudbm6vWkXcnJ33GE9"/>
<operation-setting persistence-interval="1000ms" persistence-retries="3" persistence-interval-longer="60sec"/>
</data-persistence>
<provider-settings>
<provider-settings provider-type="ncache-persistence" connection-string="lxxKK7Xqh0Tpm3rPvPOmYcCRYyeUV8f8NswyNRFum/uA0HXudbm6vWkXcnJ33GE9"/>
<operation-setting>
<operation-setting persistence-interval="1000ms" persistence-retries="3" persistence-interval-longer="60sec"/>
1000ms
.3 seconds
. <alerts>
<alerts>
<email-notification email-notification="True" sender="" smtp-server="smtp.diya-tech.com" smtp-port="25" tls="True" security-protocol="tls12" authentication="False" sender-login="" sender-password="">
<recipient email-id=""/>
</email-notification>
<alerts-types cache-stop="False" cache-start="True" node-left="False" node-joined="False" state-transfer-started="False" state-transfer-stop="False" state-transfer-error="False" partial-connectivity-detected="False" cache-size="False"/>
</alerts>
<email-notification>
<email-notification email-notification="True" sender="john_smith@alachisoft.com" smtp-server="smtp.alachisoft.com" smtp-port="25" tls="True" security-protocol="tls12" authentication="False" sender-login="" sender-password="">
False
.False
. <alerts-types>
False
.<alerts>
<alerts-types cache-stop="False" cache-start="True" node-left="False" node-joined="False" state-transfer-started="False" state-transfer-stop="False" state-transfer-error="False" partial-connectivity-detected="False" cache-size="False"/>
</alerts>
See Also