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 our focus today being on the second.
In such a time of uncertainty, NCache aims to provide its customers with some additional control and some additional 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, even if it is only for extra security.
Why Do We Need Persistence?
To truly understand what situations may arise and why cache data (data that by its definition is derived from another source) could be so essential, let us discuss an example.
Suppose you are suddenly faced with catastrophic failure or you want to bring down your entire cache cluster for maintenance. This will lead to you losing all cache data (including application data) meaning your application will have to slowly reprocess everything. Additionally, if your trips to the original data source are costly due to money or time, the entire repopulation process can be a real pain.
So, if these scenarios are weighing on your mind, you can rest easy with the NCache Persistence store – where 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 merely 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 should they face any missing data. And taking this case of missing data even further, if you face a cache restart, the persistence store ensures minimal to no data loss.
How to Initially Add Data to The Persistence Store?
To get started yourself, 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 most crucial datasets. Additionally, the related refresher feature periodically updates these preloaded datasets based on the time intervals you provide to prevent them from going stale, which the cache replicates in the persistence store.
Creating A New Distributed Cache with Persistence
While making guesses on cache size 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 web manager or your NCache PowerShell module. If you are using web manager, 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 page.
- At this point, the web manager 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:
New-Cache -Name demoCache -Server "220.127.116.11,18.104.22.168" -InMemoryStoreType DistributedCacheWithPersistence -NewPersistenceStore
-PersistenceStoreConnectionString "\\fileserver\stores;domain_name\user_name;password" -Topology PartitionedOfReplica -Size 1024
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: Why NCache?
NCache server-side functionality is ideal for cache persistence support, and we tried 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 far beyond regular cache systems, and all this takes place without any coding effort.
All things considered, any serious database and network-based enterprise would be ill-advised in not at least considering employing such a persistent store. And you can get started on your evaluation right now with our 60-day free trial.