NCache is a performance optimization solution that offers scalability and high availability. It provides various caching topologies to provide linear scalability along with data consistency and reliability. These topologies are designed to cater different caching needs of applications operating in a small two-server caching environment to huge cache clusters with hundreds cache servers.
Following are the characteristics of the caching topologies that NCache offers:
Replicated Cache
The topology ensures data reliability through data replication on multiple cache servers. The Replicated Cache is extremely fast and scalable for read operations. But, it is not very scalable for write operations, as they are synchronous to all servers in the cluster. The topology is intended for smaller caching environments where the number of read operations is higher than the write operations. Following is the brief overview of how the Replicated Cache topology works.
How Replicated Cache Topology Works?
The Replicated Cache topology offers high data availability and It supports dynamic server addition and deletion without stopping the existing cache.
Unlike the Partition and Partition Replica topologies, each client application connects to just one server node based on a load balancing algorithm determined by the cache servers. When the connected server goes down, the client application connects to the next server in the list.
Mirrored Cache Topology
The Mirrored Cache is a 2-node Active/Passive cache cluster designed for smaller caching environments. The topology offers data reliability and availability through asynchronous replication/mirroring from the Active Node to Passive Node.
How Mirrored Cache Topology Works?
In the Mirrored Cache topology, the client nodes only connect to the active server node in the cluster, for all read and write operations. If the active server node goes down, the client applications automatically connect with the previously passive node. This failover support ensures that the Mirrored Cache is always up and running. The topology offers async mirroring for write operations that helps in improving application’s performance as multiple writes are performed as a BULK operation on the passive server node.
Partitioned Cache
It is one of the fastest and most scalable caching topologies offered by NCache. The topology is equally efficient for both read and write operations. It achieves linear scalability by adding servers to the cluster. Below is a brief overview of how Partitioned Cache Topology works.
How Partitioned Cache Topology Works?
In the Partitioned Cache topology, the cache gets divided into portions at runtime with a single partition for each cache server. These partitions collectively make a clustered cache with 1000 buckets, equally distributed in all partitions. The cluster creates Distribution Map that contains the mapping of buckets in different partitions. This map ensures meaningful communication between client and server nodes.
The topology also provides high data availability by connecting all the client applications to cache servers. So that the application can get the required data even if the connected server goes down, by requesting the other servers.
Partition Replica Cache Topology
This is the most popular caching topology in NCache. As it provides users with the best of both worlds, with the linear scalability and high data reliability. This topology is nearly as scalable as Partitioned topology and provides promising performance and high data availability with synchronized and asynchronized replication modes. Following is a brief overview of how this topology works.
How Partition Replica Cache Topology Works?
Along with the creation of dynamic partitions, the topology also creates dynamic replicas of these partitions on different server nodes – which serve as a backup when there is a connection failure or node down scenario. In such cases, NCache gets data from the replica node and redistributes it. However, these replicas limits cluster scalability, as every server node added will be divided into active and replica partitions.
The topology offers two replication modes; synchronized and asynchronized. In asynchronized replication all the replicas will be created in the background, resulting in zero performance lags. But this involves a slight chance of data loss when the replica is down, as data won’t reach there. To avoid any such loss the topology also offers synchronized replication where there is runtime creation of replicas and every operation failed on replica will be considered failed on the partition as well. The topology provides full server connectivity to ensure high data availability.
Client Cache Topology
In the Client Cache topology, the cache resides very close to your application and lets you quickly cache the data from the distributed cache. The Client cache can also be considered a “cache on top of cache”. It is suitable for read intensive applications, but if your application has to perform an equal number of read and write operations, then it will work slower, because write operations will require updating the data in two places.
Although, the client cache is local, it is not standalone as it is always synchronized with the clustered cache. This synchronization ensures that data in the client cache is always updated. The following is an overview of are the main characteristics of Client Cache topology.
How Client Cache Topology Works?
The Client Cache exists either in InProc (inside your process) or OutProc mode (local to web/app server). In both cases, it improves your application performance. InProc mode lets you cache objects on your “application heap” which gives you “InProc Speed” other distributed cache. The best thing about the Client Cache is that it involves no code change in your application. Instead, you simply plug it in through a configuration change.
The topology offers optimistic and pessimistic data synchronization. The default synchronization in the Client cache is optimistic, where NCache client assumes that whatever data the Client Cache has is the latest copy. In pessimistic synchronization, Cache Client first checks the Clustered Cache whether it has a newer version of a cached item. If it does, then the client fetches it, puts it in the Client Cache, and returns it to the client application.
Conclusion
NCache offers a variety of caching topologies to fulfill the different caching needs of its customers. All of them are distributed, highly scalable, and reliable. Depending upon the size of your data, nature of operations you need to perform, and the number of transactions you have to make, you can choose any of the mentioned topologies. To explore more about NCache topologies do not hesitate to download 60 days free trial of NCache.