Cache Size
NCache allows you to configure a maximum cache size (in MBs) to control memory usage and ensure stable, predictable performance in distributed caching environments. This setting defines an upper memory limit for cached data, helping prevent OutOfMemory exceptions on cache servers. When the cache reaches this limit, or when available system memory drops below 10%, NCache automatically evicts items based on the configured Eviction Policy, maintaining optimal performance and application reliability.
Cache Size is a critical configuration option that determines how much physical and virtual memory an NCache instance can consume. By enforcing this limit, NCache ensures safe memory utilization under heavy workloads while enabling administrators to fine-tune cache behavior according to system resources and application requirements. Automatic eviction based on policy ensures cache stability, data availability, and uninterrupted operations in production environments. The maximum size of a cache can be specified using the following ways:
How to Configure Cache Size via NCache Management Center
Launch the NCache Management Center by browsing to http://localhost:8251 or
<server-ip>:8251.In the left navigation bar, click on Clustered Caches or Local Caches, based on the cache to configure. Against the cache name, click on View Details.
This opens up the detailed configuration page for the cache.
In the Overview tab, click on the
button.Change the Max Cache Size which is in MBs.

- Click on
to save the cache configuration.
How to Configure Cache Size using PowerShell and CLI
The New Cache tool enables the user to create a new cache on one or more server nodes. This command creates a local cache of size 1024 MB on the node 20.200.20.40. Although, you can change it to any size you prefer.
How to Manually Edit NCache Configuration
You can specify the Cache Size through config.ncconf by specifying the <storage> tag under the <cache-settings> tag:
Important
Ensure you stop the cache before making any configuration changes.
<cache-settings cache-name="demoCache" inproc="False" last-modified="" auto-start="False" data-format="Serialized" serialization="Json">
<storage type="heap" cache-size="1024mb"/>
...
</cache-settings>
Once the changes are made, start the cache, and restart the NCache Service.
Troubleshooting
Out of Memory Problem
This usually happens when the Maximum Size for the cache is not specified correctly. Often, the processing overhead is not considered while specifying the Maximum Size.
Workaround
To resolve memory issues, NCache provides a memory-based cache, where you can specify an upper limit on the size of the cache in MBs. You should specify a Maximum Size which, if completely consumed, still leaves enough space in the system so that it never presents as low resources. While specifying the Cache Size, consider the following factors:
- Average size of sessions or objects.
- The number of expected sessions or objects.
- The available memory for the NCache process.
Then you can calculate the required memory by keeping the following in mind.
- There is a 15% Overhead per session.
- There is a 15-20% overhead for processing. If the object size is greater than 80KB, this ratio may be a little bit high.
See Also
Cache Isolation Levels
Cache Data Expiration
Error Logging
Management Operations