• Facebook
  • Twitter
  • Youtube
  • LinedIn
  • RSS
  • Docs
  • Comparisons
  • Blogs
  • Download
  • Contact Us
Download
Show / Hide Table of Contents

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.

NCache Management Center "View Details" screen showing list of caches for selecting and configuring cache settings.

  • This opens up the detailed configuration page for the cache.

  • In the Overview tab, click on the Edit Cache Settings NCache Management Center button.

  • Change the Max Cache Size which is in MBs.

NCache Management Center Overview tab with highlighted Max Cache Size field showing configuration of maximum cache memory in MB.

  • Click on Save Cache Settings NCache Web 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.

  • Windows
  • Linux
New-Cache -Name demoCache -Server 20.200.20.40 -Size 1024
new-cache -name demoCache -server 20.200.20.40 -size 1024

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

Contact Us

PHONE

+1 214-619-2601   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • Edition Comparison
  • NCache Architecture
  • Benchmarks
Download
Pricing
Try Playground

Deployments
  • Cloud (SaaS & Software)
  • On-Premises
  • Kubernetes
  • Docker
Technical Use Cases
  • ASP.NET Sessions
  • ASP.NET Core Sessions
  • Pub/Sub Messaging
  • Real-Time ASP.NET SignalR
  • Internet of Things (IoT)
  • NoSQL Database
  • Stream Processing
  • Microservices
Resources
  • Magazine Articles
  • Third-Party Articles
  • Articles
  • Videos
  • Whitepapers
  • Shows
  • Talks
  • Blogs
  • Docs
Customer Case Studies
  • Testimonials
  • Customers
Support
  • Schedule a Demo
  • Forum (Google Groups)
  • Tips
Company
  • Leadership
  • Partners
  • News
  • Events
  • Careers
Contact Us

  • EnglishChinese (Simplified)FrenchGermanItalianJapaneseKoreanPortugueseSpanish

  • Contact Us
  •  
  • Sitemap
  •  
  • Terms of Use
  •  
  • Privacy Policy
© Copyright Alachisoft 2002 - . All rights reserved. NCache is a registered trademark of Diyatech Corp.
Back to top