Looking for Appfabric Alternatives?
Today’s applications need to scale and handle extreme data loads due to explosion of web technologies and Internet of Things. The biggest bottleneck in the way of achieving this is the data tier with relational databases. The need of the hour is to be able to make this data available to applications in a faster and more efficient way.
You can achieve this by using distributed caching of data that facilitates faster response times. There are a few big names in this domain with less than competitive products, e.g. Microsoft with their AppFabric caching product. In contrast to this NCache is an Open Source Distributed Cache that offers cutting edge technology and features.
An interesting point to note here is that Microsoft is no longer pushing AppFabric in their flagship cloud environment called Microsoft Azure. Instead, they’re recommending another Open Source cache called Redis (read NCache vs Redis Comparsion). Why Microsoft chose to do so will become clearer as you read this article.
In the next few paragraphs, I’m taking a somewhat detailed look at some of the core differences between NCache and AppFabric.
1 – High Availability of Cache (Peer to Peer Architecture)
A distributed cache runs in your production environment and as part of your application deployment. Therefore, you should treat it just like a database when it comes to high availability requirements.
Any distributed cache that does not provide a peer to peer architecture for the cache cluster becomes very limiting. AppFabric does not provide such a clustering architecture and therefore is not as flexible as NCache for providing high availability. NCache provides a truly peer to peer clustering.
2 – Synchronization with Data Sources
A very core requirement of caching data is to keep it from getting stale. In plain simple words this means that the cache needs to refresh its data every time there is an update or remove operation in the master database. NCache provides a very strong mechanism to do this called “Data Synchronization” through three types of dependencies:
- SqlDependency (SQL Server 2005-2012 events)
- OracleDependency (Oracle events)
- Db Dependency (polling for OLEDB databases)
This is a feature that AppFabric lacks even though it is core to a powerful distributed cache.
3 – WAN Replication
As the name suggests, WAN replication deals with the availability of data in geographically dispersed data centers. NCache provides powerful WAN replication capability for its distributed cache in the following data center configurations:
- Active – Passive
- Active – Active
The first case is applicable to the situation where you want to have one data center to handle all user requests i.e. Active data center. And at the same time have a backup data center for disaster recovery, i.e. Passive data center. All the data operations on the active data center are replicated to the passive data center asynchronously. So that if the active DC goes down the passive will become active and start serving user requests.
The second case is applicable to the situation where you want to have two active data centers serving users in their nearby geographical area. Since both DCs are active, data would be getting replicated in both directions. So that if a need arises to reroute all traffic to one data center, in case one of the DCs is overwhelmed or goes down, it can be done without any data integrity issues.
AppFabric fails to provide this very much needed functionality at all levels.
4 – Search Cache with SQL
The real power of a cache lies in the fact that once it has the data, it should be made easily searchable and accessible. NCache comes with very handy tools to accomplish this task. Here they are:
- Object Query Language (OQL)
- Group-by for Queries
- Delete Statement in Queries
- LINQ Queries
AppFabric does not provide any of this and hence lacks behind NCache on this avenue as well.
5 – Memcached Smart Wrapper
NCache provides the ability to integrate with Memcached in a seamless way using Memcached integration.
For those of you not familiar with Memcached, it is a popular distributed cache that is being used in the market but offers very basic caching features. Does not provide any support for high availability, data replication, cache elasticity, and ease of management.
AppFabric does not provide any such integration, so to be able to adapt to AppFabric for someone using MemCached there is only one way; Rewrite your code from scratch!
6 – Cache Size Management – Priority Evictions
To be able to use memory available to the cache efficiently we have the concept of evictions. Simply put it means to remove relatively old data from the cache so that we may have space for newer items. There are a number of algorithms that NCache employs to carry out this important task, such as:
- Least Recently Used (LRU) Evictions
- Least Frequently Used (LFU) Evictions
- Priority Evictions
- Do Not Evict Option
Each of these options has its own advantages and disadvantages over others, with one being most suitable for a particular use case. AppFabric only supports LRU evictions; this is a big limitation as some scenarios might demand to keep older data and to evict using some other matrix.
For feature by feature comparison of NCache with AppFabric please take a look at the following link: AppFabric vs NCache
Also read: Step-by-Step Appfabric Migration