Try Playground
Show / Hide Table of Contents

Cache Size

Through this configuration option, you can specify an upper limit on the size of the cache in MBs. The number of items in the cache is limited by the maximum size of the cache and the amount of free system memory (virtual or physical).

Note

This feature is also available in NCache Professional.

If some eviction policy is specified, whenever the total data size in the cache reaches maximum size or when less than 10% of memory is left in the system, items are removed from the cache as per eviction policy. The maximum size of a cache can be specified using the following ways:

Set Cache Size Using the NCache Management Center

  • Launch the NCache Management Center by browsing to http://localhost:8251 or <server-ip>:8251 on Windows and Linux.

  • In the left navigation bar, click on Clustered Caches or Local Caches, based on the cache server to start. Against the cache name, click on View Details.

View Cache Details

  • 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 Cache Size

  • Click on Save Cache Settings NCache Web to save the cache configuration.

Set Cache Size Using the Using Command Line Tools

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 20.200.20.40 node. 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

Manually Editing NCache Configuration

Important

Ensure you stop the cache before making any configuration changes.

You can specify the Cache Size through config.ncconf by specifying the <storage> tag under the <cache-settings> tag:

 <cache-settings cache-name="this" alias="" inproc="False" last-modified="" auto-start="True" data-format="Binary">
    ...
    <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

In This Article
  • Set Cache Size Using the NCache Management Center
  • Set Cache Size Using the Using Command Line Tools
  • Manually Editing NCache Configuration
  • Troubleshooting
    • Out of Memory Problem
  • See Also

Contact Us

PHONE

+1 (214) 764-6933   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • NCache Enterprise
  • NCache Professional
  • 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 - 2025. All rights reserved. NCache is a registered trademark of Diyatech Corp.
Back to top