Memory
Important
In case you want to update any cache settings please refer to the Update Cache Config section to follow the set of steps.
Configure Memory Settings
Buffer size
The Buffer Size of the client socket can be specified in the service config.
SendBufferSize
will specify send buffer size of the connected client socket, in bytes.
<add key="NCacheServer.SendBufferSize" value="131072"/>
ReceiveBufferSize
will specify the receive buffer size of the connected client socket, in bytes.
<add key="NCacheServer.ReceiveBufferSize" value="131072"/>
LOH (Large Object Heap) Size
A buffer having size greater than 80Kb is created on the Large Object heap(LOH). Garbage Collector doesn't compact the large heap for its better performance. Therefore NCache uses a pool for large buffers. NCache reserves two buffers per client. These buffers are allocated through LOH buffer pool. LOHPoolSize
refers to the initial size of the pool i.e how many buffers are allocated initially. LOH pool can increase its size by LOHPoolSize on demand.
<add key="NCacheServer.LOHPoolSize" value="40"/>
LOHPoolBufferSize
is the size of an individual buffer allocated by LOH Pool. Default buffer size is 512Kb.
<add key="NCacheServer.LOHPoolBufferSize" value="512"/>
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"/>
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"/>
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"/>
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. NCacheServer.ServiceGCCollectionInterval
can be used for limiting the
GC collection on a specified interval. This value is in minutes.
GC collection can be stopped by providing value 0.
<add key="NCacheServer.ServiceGCCollectionInterval" value="180"/>
For Mirror and Partitioned Replica Cache Topologies items are asynchronously replicated to the backup nodes in bulk. This is the number of items in one bulk sent to the backup node in single async call.
<add key="NCacheServer.BulkItemsToReplicate" value="50"/>
See Also
Configure Caches
Cache Settings
Server Connectivity
Windows Events