NCache is an extremely fast and scalable in-memory distributed cache for .NET/.Net Core applications. Mostly, NCache is used in production environments for mission-critical applications that are often customer interactive as well. In such applications, high availability and 100% uptime are extremely vital requirements that NCache needs to cater to. And NCache does cater to these requirements very effectively and through many features.
Among such features is Live Upgrade that lets you upgrade NCache to a newer version without inducing any application downtime.
The prominent delay of manually upgrading servers is significantly reduced through the Live Upgrade feature. NCache allows you to upgrade all the servers of a cache cluster with minimum lag. NCache, by design, requires all servers to be running the same version of NCache. This is done to prevent any version incompatibility issues.
To keep your cluster version up-to-date, NCache offers Bridge topology for WAN replication that acts as a bridge between two cache clusters. In this way, you can incrementally replicate the data of your currently running cache to the latest NCache cache using that bridge in between while the caches continue to run.
Follow the steps provided here to upgrade your cluster’s caches through Live Upgrade.
In your cluster, if you have 2 or more cache servers, take a subset of them out to upgrade the NCache server software on those servers.
When taking a subset out, it’s better to have a total of 4 or more cache servers so at least 2 servers are left in the source cluster. But, in case your cluster doesn’t comprise of 4 or more servers, that’s okay too. However, in such a case, your application can face downtime if the only server aiding your application goes down.
After you have upgraded NCache on 2 or more cache servers, create a cluster of them all and start cache on these servers. You must have at least 2 servers in each sub-cluster to ensure high availability - if there is just one server and it goes down, you might experience downtime.
After you have successfully created a cluster comprising of all cache servers running a newer version of NCache, create a bridge between the new cluster (commonly known as target) and the older version cluster (source).
To create this bridge, you can either use two dedicated servers with the older version of NCache or run bridge topology on two of the servers with a running older version of NCache. Use active-passive configuration of the bridge topology and wait until the target cluster is completely in-sync with the source cluster.
On the bridge node, you need to add IPs of the target cache to populate bridge servers. You can do so through bridge.ncconf as follows:
<configuration> <bridge-config … > <cache … servers-list="18.104.22.168, 22.214.171.124" … /> </bridge-config> </configuration>
After both clusters have fully synchronized, you need to take a subset of the clients and migrate it all to the new version cache cluster. Once they have been migrated, you need to immediately stop all clients connected to the old versions. This cache client migration through active-passive bridge ensures that there is no data loss and no interruption in the client application operations.
After client connections have successfully been transferred to the target cluster, the source cluster needs to be stopped and upgraded. After upgrading NCache software on all of its servers, add these servers to the newer version cache cluster.
That should be your last step in using the Live Upgrade feature of NCache to upgrade your existing cache cluster.
Now you need to migrate the remaining clients connected to the old version to the new version cache cluster. After all your clients have been successfully migrated, you can start running your application on them.
In case you don’t want to upgrade your cache clients, NCache allows older version clients to seamlessly work with newer version cache cluster. So, it’s up to you whether you want to upgrade your clients or keep the older version NCache clients on your application servers or web servers (NCache remote clients). Your application will run perfectly even if all your cache servers have been upgraded to the newer version. This all is possible because NCache provides backward compatibility for clients.
It is recommended to upgrade NCache client software on your application and web servers because the newer client might come packed with some essential bug fixes. This process is extremely easy and seamless. That’s because the newer version of the client is backward compatible with the older version. This compatibility lets your application to work with the newer client without noticing any change whatsoever. The best part about using Live Upgrades in your application is that it doesn’t require any code change or recompilation. You just need to upgrade the version of NCache client software and the rest is done for you automatically.
To get detailed step-to-step instructions on how to use Live Upgrade feature to upgrade your NCache cluster, follow our documentation on Live Upgrade NCache Version.