Memory Configurations
Important
To update any cache settings, follow the steps provided in the Update Cache Config section.
Configure Memory Settings
There are several options available for configuration, as detailed below.
Buffer size
To specify the buffer size of the client socket, go to the service config file. In the service config file, the SendBufferSize
specifies the send buffer size of the connected client socket in bytes.
<add key="NCacheServer.SendBufferSize" value="131072"/>
The 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 greater than 80Kb. 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. The LOH buffer tool allocates these buffers.
The 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"/>
The LOHPoolBufferSize
is the size of an individual buffer allocated by the LOH Pool. The default size of the buffer is 512Kb.
<add key="NCacheServer.LOHPoolBufferSize" value="512"/>
Configure Windows Events Logging
The CacheSizeThreshold
is the threshold value for the cache size from the total size 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 out the following line of code.
<add key="NCacheServer.CacheSizeThreshold" value="80"/>
The CacheSizeReportInterval
is the interval during which a CacheSizeThreshold
warning is issued once. This interval is in minutes. If, due to eviction, the cache size falls below the provided the CacheSizeThreshold
and afterward crosses the CacheSizeThreshold
limit then, the warning will not be generated. The minimum value of the 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 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 set into smaller chunks of data.
To specify the size of a response, the 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 are treated 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"/>
Configure Enumeration
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. The Enumeration process takes four attributes. They are as discussed below.
To enable enumeration on the cache, the NCacheServer.SnapshotPoolingCacheSize
helps to specify the size in terms of the number of items present in the cache. This number helps decide 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 can be set through the 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, the 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. The default time is 30 seconds.
<add key="NCacheServer.SnapshotCreationThreshold" value="30"/>
To specify the chunk size for enumeration, use the NCacheServer.EnumeratorChunkSize
. The 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. The default value provided by NCache for the 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. The 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"/>
See Also
Server Connectivity
Server Ports
Windows Events
Expiration & Eviction