Cache Server Settings
This section explains various cache server configurations in Alachisoft.NCache.Service.exe.config. All configurations in this file will be needed at the start of NCache service.
Please note that for .NET Core installation, the file name is Alachisoft.NCache.Service.dll.config.
The service configuration file hosts all cache related configurations. For any change in cache configuration, you can either manually update this file or use NCache Manager to update it. This file updates with every change made at NCache Manager. Here you can specify the port at which cache server will listen for the incoming connection requests. Send/receive buffer size of connected client sockets is also given here. You can also identify cache(s) that you want to start at boot in the service configuration file.
This file is located at %NCHOME%/bin/service
.
Client/Server TCP Port
Client/Server TCP Port in service config will specify the port at which Cache Server will listen for incoming connection requests.
<add key = "NCacheServer.Port" value = "9800"/>
Enable License Logging
Enable License Logging in service config will specify whether this service will log license information for clients or not.
<add key = "NCacheServer.LicenseLogging" value = "false"/>
Bind Multiple NICs
When your machine has more than one network cards, you can inform NCache which interface to use for cluster-wide communication. In order to do so, provide IP Address you want the cluster server to bind with in service config.
<add key = "NCacheServer.BindToClusterIP" value = "20.200.20.39"/>
You can follow the above procedure for client communication. Provide the IP Address you want the client's (NCache client) server to bind with.
<add key = "NCacheServer.BindToClientServerIP" value = "20.200.20.39"/>
Auto Start Cache on Reboot
You can configure caches to start with the start of NCache service. As, by default NCache service starts at the system startup so these settings are useful incase you want some caches to auto start at the system startup.
<add key = "NCacheServer.AutoStartCache" value = "mycache,myreplicatedcache,mypartitionedcache"/>
<add key = "NCacheServer.CacheUser" value = "domain/userId"/>
<add key = "NCacheServer.CachePassword" value = "password"/>
Enable Debug PerfMon Counters
Some performance counters are disabled by default but they can be really helpful to see NCache behavior over the network. These counters include:
Socket send time (time taken for the last send operation)
Socket receive time (time taken for the last receive operation)
Bytes sent/second
Bytes received/second
Nagling message count (number of messages bundled together in the last socket send operation)
TcpUpQueueCount: Number of items in TCP up queue.
TcpDownQueueCount: Number of items in TCP down queue.
BCastQueueCount: Number of items in BCast Queue.
MCastQueueCount: Number of items in MCast Queue.
These counters help find the source of the problem in case we see the cluster is not performing as expected.
<add key = "NCacheServer.EnableDebuggingCounters" value = "true"/>
Configure Expiration Cleanup
Expired items are removed in bulk. Specify the size of the bulk operation i.e. how many items should be removed in one bulk operation.
<add key = "NCacheServer.ExpirationBulkRemoveSize" value = "10"/>
Expired items are removed in bulk. This may affect the performance of user operations during expirations. This delay specified (in milliseconds) causes a delay between two consecutive bulk remove operations.
<add key = "NCacheServer.ExpirationBulkRemoveDelay" value = "0"/>
Configure Eviction Cleanup
During eviction items are removed in bulk. Specify the size of the bulk
operation i.e. how many items should be removed in one bulk operation.
EvictionBulkRemoveSize
should be specified in multiple of 300.
<add key = "NCacheServer.EvictionBulkRemoveSize" value = "10"/>
During eviction items are removed in bulk. This may affect the performance of user operations during expirations. This delay specified (in seconds) causes a delay between two consecutive bulk remove operations.
<add key = "NCacheServer.EvictionBulkRemoveDelay" value = "0"/>
Configure Windows Events Logging
CacheSizeThreshold
is the size of cache in percentage of total cache size.
When this threshold is reached a warning message is logged into system event
log. No warning message is logged if the following line is commented.
<add key = "NCacheServer.CacheSizeThreshold" value = "80"/>
CacheSizeReportInterval
is the interval in minutes during
which CacheSizeThreshold
warning is issued once. If cache size falls
below CacheSizeThreshold
due to eviction and again crosses
the CacheSizeThreshold
limit during this interval no warning is generated. The
minimum value is 5 minutes.
<add key = "NCacheServer.CacheSizeReportInterval" value = "15"/>
Enables/Disables the logging of client connectivity events into event viewer. By default these events are disabled.
<add key = "NCacheServer.LogClientEvents" value = "false"/>
Specifies the level of events which are logged into event viewer. There are three levels of events:
- ERROR : Only errors will be logged
- WARNING : Errors and Warnings will be logged
- All : all events will be logged
<add key = "NCacheServer.EventLogLevel" value = "all"/>
Configure .NET Garbage Collection
Enables/Disables forced garbage collection when using Server GC. Applicable on
server operating systems only. Possible values are 'true' or 'false'. If value
is true, a forced GC.Collect()
is called after system memory usage reaches a
specific threshold. This threshold is specified under property
'NCacheServer.ForcedGCThreshold'
. Default value for this property is 'true'.
<add key = "NCacheServer.EnableForcedGC" value = "true"/>
%age Memory usage threshold that is used to call forced garbage collection. This property depends on property 'NCacheServer.EnableForcedGC'. If the property is set 'true', given threshold value is used to call explicit Garbage collection. Default value is 80. This implies that an explicit GarbageCollection should be called when system memory usage reached 80% of the total memory.
<add key = "NCacheServer.ForcedGCThreshold" value = "80"/>
Value of seconds after which service should check if it needs to do a forced garbage collection. This property dictates how frequent you want to check if a forced Garbage Collection is required or not. Default value is 20 seconds. Minimum possible value is 5 seconds.
<add key = "NCacheServer.ForcedGCInterval" value = "20"/>
Configure SQL Dependency
SQL Dependency can be used in two modes i.e. Default mode or Custom mode. In default mode, SQL Dependency creates a default service and queue at run time. In case of Custom mode, a customer defined SQL Dependency service and queue will be created and used by NCache. In this case, NCache will connect with the pre-created service and queue with following naming convention:
- "NCacheDBService-[IP-Address]"
- "NCacheDBQueue-[IP-Address]"
You can change the SQL Dependency service and queue name prefix by specifying it
against the NCacheServer.NCacheDBServicekey
/NCacheServer.NCacheDBQueue
key.
<add key = "NCacheServer.NCacheSQLNotificationService" value = "NCacheSQLService"/>
<add key = "NCacheServer.NCacheSQLNotificationQueue" value = "NCacheSQLQueue"/>
Configure Response Data Size
NCache introduces "Response Data Size" to limit the large result sets returned in response to bulk Search, Tags and Groups operations. .NET framework does not support the serialization of large result sets which exceeds the size of 1.9Gb. To solve this problem NCache splits the large result sets into smaller chunks of data.
NCacheServer.ResponseDataSize
can be used to specify the size of a response.
It will help in limiting a response size by dividing the bigger response into
multiple responses each containing the data approximately equal to the specified
limit. These multiple responses will be merged by the NCache Client as a single
response. Here it takes value in MBs. Default size is 1024MB.
<add key = "NCacheServer.ResponseDataSize" value = "1024"/>
Note
At least one object must be sent in response even if the data size of an object exceeds the specified limit for data.
Configure Max Response Length
NCache introduces "Max Response Length" to limit the large result sets returned in response to all operations whether bulk or not .NET framework does not support the serialization of large result sets which exceeds the size of 1.9Gb. To solve this problem NCache splits the large result sets into smaller chunks of data.
NCacheServer.MaxResponseLength
can be used to specify the size of a response.
It will help in limiting a response size by dividing the bigger response into
multiple responses each containing the data approximately equal to the specified
limit. These multiple responses will be merged by the NCache Client as a single
response. Here it takes value in KBs. Default size is 512KB.
<add key = "NCacheServer.MaxResponseLength" value = "512"/>
Note
At least one object must be sent in response even if the data size of an object exceeds the specified limit for data.
Configure Enumeration
The purpose of introducing enumeration is to keep cache free from locking while enumerating the cache data. This process eventually increases the cache performance and its availability for clients. NCache is following the technique of taking snapshots of cache data and send it to the client for enumeration which keeps the cache free from being locked during the process of enumeration. Four attributes are defined for enumeration, which are:
NCacheServer.SnapshotPoolingCacheSize
can be used to specify the size of the
cache (in terms of number of items) for enabling enumeration on cache. It will
help in deciding whether to create a pool of snapshots for enumeration or not. A
complete snapshot of cache is returned to the enumerator until the threshold
reaches its limit. Once the threshold value is crossed, cache will create a pool
of snapshots that will hold those snapshots based on time slicing. These
snapshots will be provided to the enumerator on demand from client by the cache
server. Default Size is 100000 items in cache.
<add key = "NCacheServer.EnableSnapshotPoolingCacheSize" value = "100000"/>
NCacheServer.SnapshotPoolSize
can be used to specify the number of snapshots
allowed in the pool for enumeration. Once the pool reaches its maximum limit, it
won’t allow more snapshots to be added to the pool. It will wait till any
existing snapshot in the pool has been removed. Default Size is 10 snapshots in
cache snapshot pool.
<add key = "NCacheServer.SnapshotPoolSize" value = "10"/>
NCacheServer.SnapshotCreationThreshold
can be used to specify after how many
seconds a new snapshot will be added to pool for enumeration purpose. Same cache
snapshot from the pool is provided to all enumerators on cache until the
threshold time is elapsed. Any enumerator that requests a snapshot after that
will get a new snapshot from the pool. Default size is 30 seconds.
<add key = "NCacheServer.SnapshotCreationThreshold" value = "30"/>
NCacheServer.EnumeratorChunkSize
can be used to specify the chunk size for
enumeration. Chunk size is the number of cache items returned to the enumerator
from cache server. Once the enumerator is done enumerating through a chunk of
data it will get the next chunk from the cache server for enumeration. Default
size is 1000 items returned in each chunk.
<add key = "NCacheServer.EnumeratorChunkSize" value = "1000"/>
Cache Startup Loader Delay
User can introduce a delay in Cache Startup Loader in order to avoid some data loss problems which may occur while the cache is still in process of member joining. This is done by setting the following property:
<add key = "NCacheServer.CacheLoaderStartupDelay" value = "20"/>
The value of this property is set in seconds. By default, this value is 20 while minimum value is 10 seconds.
See Also
Cache Settings
Cache Client Settings
Configure Security
Client Cache Settings