We are currently living through unprecedented times. The currency of the day is data, with a never-before-seen emphasis on its collection, preservation, and analysis – with this blog focusing on data preservation.
In such uncertain times, NCache aims to provide its customers with some additional control and peace of mind with its Persistence store. Persistence refers to writing data in a specific location for durable storage and data backup. And as an overview, this is the perfect explanation of what this NCache store does.
Caching, by its very nature, is subject to volatility. And despite the stability, quality performance, and high availability, of a product like NCache, some circumstances necessitate cache data back-ups.
Why Do We Need Persistence?
To truly understand what situations may arise and why cache data could be so essential, let us consider an example. Suppose you are suddenly faced with catastrophic failure, or you want to bring down your entire cache cluster for maintenance. You will end up losing all cached data (including application data) leading to slowed application processing and response times. Additionally, the resource intensive database trips will make the entire repopulation process a real pain. So, if these scenarios are weighing on your mind, you can rest easy with the NCache Persistence store. It ensures that your cache is repopulated with all your valuable data upon cache restart.
How Does Persistence Work?
The entire mechanism of storing items within the persistence store is asynchronous and takes place via a persistence queue (sparing you any unnecessary waiting). A thread checks all operations in this queue (at specific intervals that you can define) and replicates them as is – while you continue with the rest of your work. As with all write operations, the cache initially loads the data into memory and then adds it to the backend store.
Furthermore, every node in your cluster can access the centralized store to repopulate if they face any missing data. Even in case of a cache restart, the persistence store ensures minimal to no data loss.

Figure 1: The detailed process of data persistence and loading
How to Initially Add Data to The Persistence Store?
To get started, you can configure your persistent cache (whether distributed or local) to employ the Cache Startup Loader option. This feature lets you preload your cache and persistence store with your datasets. Additionally, the related refresher feature periodically updates these preloaded datasets based on the time intervals you provide to prevent them from going stale.
Creating A New Distributed Cache with Persistence
While estimating a cache size in advance might be a bit complex (as it’s dependent on your requirements), creating a persistent cache is a relatively simple process.
You can create a cache using either the NCache Management Center or your NCache PowerShell module. Whether using Windows or Linux make sure to start the NCache Service. If you are using the NCache Management Center, you need to choose to create a new Distributed Cache with Persistence. And do the following:
- Set up a persistence store – you can use both existing and new stores (you can employ NFS or CFS protocols).
- Ensure your store is separate from the rest of your nodes to avoid a single point of failure.
- Test your connection before proceeding to the Advanced Options
- At this point, the NCache Management Center will redirect you to the main clustered cache page upon successful creation.
Alternatively, if you are using PowerShell, you can use the New-Cache PowerShell cmdlet and run the following command:
1 |
New-Cache -Name PersistenceCache -Server "20.200.20.11,20.200.20.12" -Size 1024 -InMemoryStoreType DistributedCacheWithPersistence -PersistenceStoreName "persistence_store" -NewPersistenceStore -PersistenceStoreConnectionString "\\Fileserver\stores\store1;domain_name\user_name;password" -Topology PartitionReplica |
Monitoring Statistics Related to Data Persistence
As an added benefit, NCache monitors all its functionality if you are worried about its working within your environment. When it comes to the persistence store, we provide specific performance counters for monitoring statistics of the persistence queue and its operations performed within a Distributed Cache. It has specific counters for PersistQ Count, PersistQ Size, Db Reads/sec, Db Writes/sec, and more.
Along with this, we encourage you to keep an eye on all basic operations to ensure that your persistence store gives you the optimum performance. You can do this via NCache itself, windows performance tools, our logs, or even PowerShell.
Conclusion
NCache’s server-side functionality is ideal for cache persistence support, and attempts to provide users with as much flexibility as possible (with several topologies and configurations ready to use). On a similar note, NCache persistence works with multiple file share systems and holds on to that information for much longer than regular cache systems, and all this takes place without any coding effort. All things considered, any enterprise relying on database and network infrastructure should strongly consider implementing a persistent store. And you can get started on your evaluation right now with our free trial.