Live Upgrades in NCache with 100% Uptime

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.

How Does Live Upgrade of a Cache Cluster Work?

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.

Step 1: Remove subset of servers for 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.

Step 2: Create a cluster of newer version servers

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.

Step 3: Create an active-passive bridge between old and new

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:

  <bridge-config … >
      <cache … servers-list="," … />

Step 4: Migrate some clients to the new version

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.

Step 5: Upgrade remaining older version servers

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.

Step 6: Migrate all cache clients to the new 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.

Use Old Clients with New Cache Cluster

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.

Use New Cache Client with Backward Compatibility API

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.

What to Do Next?

© Copyright Alachisoft 2002 - . All rights reserved. NCache is a registered trademark of Diyatech Corp.