NCache is an in-memory distributed cache for.NET/.NET Core, Java, Python, NodeJS, and Scala applications, it is extremely fast and scalable. It is utilized in production settings for mission-critical applications, many of which are also user-interactive. In such applications, high availability is crucial. And through a variety of features, NCache does a great job of satisfying these needs.
One of these features is Live Upgrade, which enables you to update NCache to a newer version without causing any interruptions to your application through a Bridge. NCache provides a Bridge topology for WAN replication that serves as a bridge between two cache clusters that maintain the most recent version of your cluster. However, the Live Upgrade feature is only available for NCache Enterprise Edition.
Why Upgrade to NCache newer versions
If you’re using an older version of NCache, we strongly encourage you to upgrade to the latest version to reap the benefits of all the latest features and enhancements. To see all the details of these features and improvements brought forward by NCache 5.3 SP1, you can read the release notes of NCache 5.3 SP1.
Live Upgrade of NCache with Negligible Data Loss
The time it takes to manually upgrade software greatly reduces via live upgradation. You can use the Live Upgrade to clone data from your presently operating cache (known as the source cache) to the most recent cache (target cache) while the caches are still running.
Due to the asynchronous nature of data replication, all clients connected to the source cache perceive activity on the source cache, even if a complete copy is seamlessly made to the target cache. The source cache setup, meanwhile, continues to operate flawlessly and is unaffected by the change.
The figure shown above displays a 4-node cluster with an older version of NCache installed. First, you stop nodes 3 and 4, and install the latest NCache version on these nodes. Next, create a 2-node cache on the newly NCache version installed machine (nodes 3 and 4). At this point, we have total two caches consisting of 2 nodes each. Let’s call them a source cache (old NCache version installed cache) and target cache (newly NCache version installed cache). Then, you need to create a bridge between these two caches to transfer data from the source cache to the target cache. Stop the source cache’s nodes and install the latest NCache version on it. Next, add nodes 1 and 2 to the target cache to make it a 4-node cluster.
Ideally, it’s better to have a 4-node cluster, so that you can split the data between the two server nodes. The division of the cluster nodes is based on the fact that this division does not cause data loss by any means. Whatever division of cluster you choose, should be able to hold equal data in its divided cluster. If you have a 2-node cluster, we don’t recommend splitting them. Instead have a temporary 2 node cluster that has the newer version of NCache installed. Once the existing 2 nodes join the new cluster, you can remove these temporary nodes.
How to Upgrade to NCache Live Version
For instance, we have a 4-node cluster as explained in the diagram in the previous section. Take out two nodes (3 and 4) and install the latest version of NCache on them (target cache). The other two nodes (1 and 2) have an old version NCache installed (source cache). Both caches are identical in terms of name and configuration. This is an active-passive configuration.
-
- Create a new bridge between these two clusters as explained on the Create Bridge page.
- In the <bridge-config>…<cache> tags of bridge.ncconf on the bridge node, manually add the target cache as follows:
1234567891011<configuration><bridge-config … ><cache cache-id="demoCache.WestCoast" status="active" servers-list="20.200.20.43" bulk-operation-size="500"enable-compression="False" connection-retry-interval="3" heart-beat-enabled="True" replicator-virtual-queue-size="2048MB" is-connected="True" is-master="False"/><cache cache-id="demoCache.EastCoast" status="active" servers-list="20.200.20.40" bulk-operation-size="500"enable-compression="False" connection-retry-interval="3" heart-beat-enabled="True" replicator-virtual-queue-size="2048MB" is-connected="True" is-master="False"/></bridge-config></configuration> - Following the bridge.ncconf modification, restart the bridge service using the following PowerShell cmdlet.
1Restart-Service NBridgeSvc - Provide the source cache and target cache as inputs to the Start-BridgeStateTransfer PowerShell command to begin state transfer.
12Start-BridgeStateTransfer -Server 20.200.20.43 -Name demoBridge -SourceCache demoCache.WestCoast -TargetCachedemoCache.EastCoast - The data will asynchronously replicate from the old cluster (active) to the newer cluster (passive).
- Once the two caches are fully synchronized, you need to stop the clients and reconnect them with the newer cluster. To do so, change the IP address of the source cache server(s) to the IP address of the target cache server in client.ncconf of each client node(s) and reconnect the clients.
- Remove the bridge.
- After the clients have been successfully connected to the newer cluster, stop the older cluster and install the newer version on it. Add these servers to the cache cluster with the newer version after upgrading the NCache software on all of its servers.
- Join the nodes 1 and 2 to the newer cluster one after the other.
Conclusion
NCache allows its users for seamless upgrades to its latest versions with negligible data loss. Users don’t have to deal with the trouble of shifting from one NCache version to the next, be it the live upgrade or the offline NCache version upgrade. For more details on NCache, please see NCache docs.