Advantages of Migrating to NCache from AppFabric

Client Cache

With AppFabric nearing its end-of-life, migration to an alternative will keep your .NET apps running smoothly. It is easy to migrate from AppFabric to NCache, but the bigger impact is if you consider the difference of features between the two products. It is huge and favors NCache. A detailed feature by feature comparison is available on the Alachisoft website: NCache vs AppFabric Comparison. As a summary, this blog presents some important and helpful basic features that NCache provides which are completely missing in AppFabric. There is a lot to gain and nothing to lose in adopting NCache to keep your apps running in top form.

1. Keeping the Cache Fresh

Database synchronization is a crucial feature for a good In-Memory distributed cache. Since a distributed cache is mostly placed in the middle tier i.e between applications and a database, there is a high probability where data is directly updated to the database or the cache independently. This calls for a mechanism to ensure data does not becomes stale.

To handle such a scenario, a good distributed cache must allow you to specify a relation or dependency between the item cached and its corresponding item in the database. This ensures whenever there is a change in the database, the changes are reflected to the cache through either invalidation or update.

For example, NCache provides SqlDependency support for SQL Server. You can create a dependency of a cached item with an SQL statement based dataset. Whenever that specific dataset changes or modified, SQL Server sends an event to NCache and the cache item is invalidated. For example;

This allows you to synchronize the cache with database. NCache also supports the same feature with Oracle Databases as well. For other cases you could opt for OLEDB Database Dependency.

Furthermore, with such a great feature why just restrict ourselves to relational databases only? NCache also allows you to synchronize the cache with non-relational data sources like FileSystem e.t.c.

2. SQL Searches

With the Cache Fresh feature at its best, it is easy to be tempted to keep most if not all of the data in the cache. But then you face the problem of searching through your cached data if fetching through Key is the only option. NCache offers a solution to this as well and that is through SQL and LINQ searching. This is possible by indexing selected .NET object attributes and performing search queries.

To enhance the developers experience, NCache also offers you to assign groups/sub-groups, tags and named tags to cached items which you can later use in your SQL queries to fetch items quickly.

3. Server Side Code

Distributed cache is sometimes used as a “cache on the side” where applications fetch data from the database and insert it in the cache. The other approach is to “cache through” that is, your application delegates this responsibility to the distributed cache. When your application requests an item from the cache, the cache determines if the item exists in the cache or not and loads the corresponding data from the database. This feature is named as read-through and write-throughwhere you can write your own logic in .NET and let the cache load the data.

Also since a distributed cache

  1. Sits near the database
  2. Is distributed
  3. And caches data in memory

Then its natural to also want to leverage some of its processing power to speed up your business processes. NCache also provides a full MapReduce framework where you can perform analysis on your cached data and produce actionable insights near real time. MapReduce code is written in .NET therefore runs within the NCache process.

4. Client Cache (Near Cache)

A Client Cache, also termed as Near Cache, is local to your web server or application and lets you cache frequently used data even either within the same process or the same server machine. So, a Client Cache is an affinity cache and gives your application further boost by decreasing network bandwidth costs without compromising on data integrity. A Client Cache works with all of the clustered caching topologies (Mirrored, Partitioned, and Partition-Replica Cache).

Client Cache

A Client Cache (Near Cache) stays connected to the cache cluster and synchronize with it replicating the changes in the main cache cluster. Difference between AppFabric local cache and NCache client cache is that AppFabric Local cache is stand alone and does not create a connection with the main cluster.

5. Multi-Datacenter Support

WAN replication is also an important feature for a good in-memory distributed cache. It is mostly used by those customers whose data-centers are geo distributed either for disaster recovery or for load balancing for localized traffic.


NCache provides Bridge topologies to handle WAN latencies. NCache Bridge replicates and maintains consistency across different cache across the globe. You either have the option to keep your cache cluster as passive to mimic a cluster replica for disaster recovery or synchronize two separate cache at different data centers. Data is asynchronously replicated over a secure Internet.

6. Dynamic Cluster

The AppFabric cluster is not completely dynamic. Dependency on “lead hosts majority rule” means cluster can go down very easily if even one of the lead host goes down. These lead host nodes also resemble “master” and “slave” architecture and is therefore not fully peer to peer as well.

NCache whereas is highly dynamic and lets you add or remove cache servers at runtime without any interruption to the cache or your application. Data is automatically rebalanced (called state transfer) at runtime without any interruption or performance degradation. NCache clients automatically maintains the communication channel with the cache servers, independent of state of server. On top of it, cache clusters ensure execution of client operations even when data balancing (state transfer) is in process.

This means that even for NCache, there is no “master” or “slave” nodes in the cluster. There is a “primary coordinator” node that is the senior most node. And, if it goes down, the next senior most node automatically becomes the primary coordinator. All of this happens without any interruption to the client operations.

7. ThirdParty Integrations

To top it off, NCache officially supports providers for different important third part libraries such as

  • Memcached Wrapper
  • Entity Framework Cache
  • NHibernate 2nd level Cache
  • ASP Session and View State Caching.
  • and more


If you’re interested in considering NCache as an AppFabric alternative then please download the AppFabric to NCache Whitepaper where the possible ways to migrate are discussed which include using NCache Enterprise or for zero cost migration the NCache open source. It also discusses the difference between how AppFabric and NCache are configured.

In short, NCache presents a wide range of features which business use and require in their .NET Applications.

Avatar for Basit Anwer

Leave a Reply

Your email address will not be published. Required fields are marked *