Follow the steps provided in the Update Cache Config section to update any cache settings.
Configure Memory Settings
To specify the buffer size of the client socket, go to the service config file.
In the service config file,
SendBufferSize specifies the send buffer size of the connected client socket in bytes.
<add key="NCacheServer.SendBufferSize" value="131072"/>
ReceiveBufferSize specifies the receive buffer size in bytes of the connected client socket.
<add key="NCacheServer.ReceiveBufferSize" value="131072"/>
LOH (Large Object Heap) Size
The Large Object Heap (LOH) creates a buffer having a size greater than 80Kb. As the larger heaps are not compacted by the Garbage Collector, so NCache uses pools for large buffers to improve performance. To achieve this, NCache reserves two buffers per client. LOH buffer tool is used to allocate these buffers.
LOHPoolSize initializes the initial size of the pool, meaning the number of buffers allocated at the start. This number is configurable through
LOHPoolSize on demand.
<add key="NCacheServer.LOHPoolSize" value="40"/>
LOHPoolBufferSize is the size of an individual buffer allocated by LOH Pool. Default size of the buffer is 512Kb.
<add key="NCacheServer.LOHPoolBufferSize" value="512"/>
Configure Windows Events Logging
CacheSizeThreshold is the threshold value for the size of cache from the total size of cache in percentage. A warning message is logged whenever this threshold value is reached. To avoid a warning message being logged in the system event logs, comment the following line of code.
<add key="NCacheServer.CacheSizeThreshold" value="80"/>
CacheSizeReportInterval is the interval during which
CacheSizeThreshold warning is issued just once. This interval is in minutes. If, due to eviction, the cache size falls below the provided
CacheSizeThreshold and afterwards crosses the
CacheSizeThreshold limit then, the warning will not be generated. The minimum value of
CacheSizeReportInterval is 5 minutes.
<add key="NCacheServer.CacheSizeReportInterval" value="15"/>
Configure Response Data Size
.NET framework does not support the serialization of large data sets that exceed over 1.9Gb. To solve this problem, NCache introduces "Response Data Size" to limit the sets returned in response to the bulk operations. "Response Data Size" splits a large result sets into smaller chunks of data.
To specify the size of a response,
NCacheServer.ResponseDataSize can be used. It helps limit the response size by dividing a bigger response into multiple small responses, each holding data of a size equal to the specified limit. These smaller responses as a single response by the NCache Client. The value
NCacheServer.ResponseDataSize takes is in MBs and its default value is 1024MB.
<add key="NCacheServer.ResponseDataSize" value="1024"/>
Enumeration is introduced to keep the cache from locking data while the cached items are being enumerated. By doing so, cache performance and its availability is increased. NCache takes snapshots of cache data and sends them to the client for enumeration so that the actual data isn't locked during this process. Enumeration process takes four attributes. They are:
To enable enumeration on the cache,
NCacheServer.SnapshotPoolingCacheSize helps to specify the size in terms of the number of items present in the cache. This number helps decided whether there's a need for taking snapshots for enumeration or not. Until the threshold limit is reached, a complete snapshot of the cache is sent to the enumerator. And once the threshold limit is reached, the cache creates a pool that holds all the snapshots based on the time slicing. When demanded by the cache server, this pool is provided to the enumerator. The default size provided by the
NCacheServer.SnapshotPoolingCacheSize is 100000 items.
<add key="NCacheServer.EnableSnapshotPoolingCacheSize" value="100000"/>
To specify the number of snapshots allowed for enumeration in a single pool for can be set through
NCacheServer.SnapshotPoolSize. The pool will not allow any more snapshots to be added in a pool once the provided limit is reached. In such a case, the pool waits for any existing snapshots to be removed form the pool and then adds the remaining snapshots. By default, only 10 snapshots are allowed in a pool at a time.
<add key="NCacheServer.SnapshotPoolSize" value="10"/>
To specify the time after which a snapshot should be added to the pool for enumeration,
NCacheServer.SnapshotCreationThreshold is used. This time is provided in seconds. All enumerators on the cache get the same cache snapshot from the pool until the threshold limit is reached. Any enumerator that requests a snapshot after that will get a new snapshot from the pool. Default time is 30 seconds.
<add key="NCacheServer.SnapshotCreationThreshold" value="30"/>
To specify the chink size for enumeration, use
NCacheServer.EnumeratorChunkSize. Chunk size shows the number of cache items returned to the enumerator from the cache server. The enumerator gets the next chunk from the cache server once it is done enumerating the provided chunk of data. Default value provided by NCache for
NCacheServer.EnumeratorChunkSize is 1000 items in each chunk.
<add key="NCacheServer.EnumeratorChunkSize" value="1000"/>
The property of NCache that provides the time in seconds after which the cache service should check if it needs to do a forced garbage collection, dictates how frequently you want to check for forced Garbage Collection. The default value provided for this property is 20 seconds. The minimum possible value it can have is 5 seconds.
To limit the Garbage Collection on a specified interval,
NCacheServer.ServiceGCCollectionInterval is used. This value is provided in minutes.
GC collection can be stopped by providing value 0.
<add key="NCacheServer.ServiceGCCollectionInterval" value="180"/>
Items are asynchronously replicated to the backup nodes in a bulk format for both Mirror and Partitioned Replica topologies of NCache.
BulkItemsToReplicate is the number of items in a single bulk sent to the backup node in one async call.
<add key="NCacheServer.BulkItemsToReplicate" value="50"/>