NCache is an extremely fast and scalable In-Memory Distributed Cache for .NET / .NET Core. Majority of the time, NCache runs in production environments for mission-critical applications that are often customer facing as well. As a result, high availability and 100% uptime is a very important requirement for NCache. And, NCache meets this requirement very effectively through a variety of features.
One of those features is Live Upgrade that allows you to upgrade NCache to a newer version without any downtime.
NCache allows you to upgrade all the servers in a cache cluster one by one without any downtime. By design, an NCache cluster can only be formed when all cache servers are of the same version. This is to prevent any across version incompatibilities to creep in.
However, NCache provides Bridge Topology for WAN replication that becomes a “Bridge” between two cache clusters of even different versions and automatically keeps them synchronized. You can use this Bridge Topology to incrementally upgrade cache servers and form a new cache cluster and at the same time keep it synchronized with the older version cache cluster.
Here are the steps you would take.
If you have 2 or more cache servers in a cluster, take a subset of them out of the cluster for upgrade. To ensure high availability throughout this Live Upgrade, make sure to have a total of 4 or more cache servers so at least 2 cache servers are left in the older version cache cluster and 2 or more are taken out for upgrade.
However, if you do not have 4 or more cache servers then you can still do Live Upgrade. But please keep in mind that for a brief period of time you have only one cache server in the cluster because the other one is being upgraded and if that server goes down then your application faces a down time.
Once you have taken out a subset of cache servers, then upgrade the NCache server software on all of them.
After upgrading NCache software on 2 or more cache servers, create a cluster consisting of all of them. In fact, create all your clustered caches on them as well and start these caches.
After successfully creating clustered caches on all the newer version cache servers, create a bridge between the newer version and older version clusters. Use Bridge Topology provided by NCache to do this.
You can either use two dedicated servers with the newer version of NCache to create this bridge or you can run Bridge Topology on two of the newer version cache servers which the cache is also running on them.
Use Active-Active configuration in Bridge Topology and wait until both versions of the clusters get fully synchronized.
After both new and old version cache clusters are fully synchronized by the Active-Active Bridge Topology, migrate all the cache clients one by one to the newer cache cluster. This incremental cache client migration ensures that there is no interruption in the client application operations.
After both new and old version cache clusters are fully synchronized by the Active-Active Bridge Topology and all the cache clients are migrated to the newer version cache cluster, now stop the older version cache cluster servers. And, then upgrade NCache software on all of them.
After upgrading the NCache software, add each of these cache servers to the newer version cache cluster.
This completes your Live Upgrade process.
NCache allows older version cache clients to work with newer version cache cluster. So, if you don’t want to upgrade NCache client at all, you can choose to keep your older version NCache clients on your application servers or web servers (basically NCache remote clients). This is possible even though you’ve upgraded all your cache servers in the cluster.
Older version cache clients are able to talk to the newer version cache cluster because the cache servers provide backward compatibility for clients.
If you are able to upgrade NCache client software on your application servers and web servers (basically NCache remote clients), that is recommended. This is because the newer client might have fixed various important bugs that are still there in the older version cache client.
Please note that upgrading NCache clients is a very easy and seamless process. This is because newer version NCache client is backward compatible to the older version client and therefore your application does not notice any change and continues to work with the newer version client as if it were the older version client. You don’t need to make any code changes or even recompile any code for this upgrade. Just install the newer version of NCache client software and rest is done automatically for you.