NCache 4.4 - Online Documentation

Caching Topologies

 
A caching topology is essentially data storage strategy in a clustered cache. NCache provides a rich set of caching topologies to let you choose the one that suits your environment best. The goal of this is to cater from very small two-server caches to very large cache clusters consisting of hundreds of cache servers. Below are the main caching topologies provided to you:
 
  • Mirrored Cache (2-server active/passive)
  • Replicated Cache
  • Partitioned Cache
  • Partitioned-Replica Cache (Asynchronous and Synchronous)
  • Client Cache (a Local Cache connected to a Clustered Cache)
 
A short explanation of each of these caching topologies is given below.
 
Reference Data versus Transactional Data:
 
Reference data use means you cache something once and read it over and over again. So, there are a lot more reads than writes. On the other hand, transactional data use means that you're updating the data as frequently as you're reading it (or fairly close to it). Originally, cache was considered good only for reference data but distributed caches have proven to be faster and more scalable than databases even for transactional data.
 
Caching a product catalog where prices change maybe once a day or so is reference use. On the other hand, ASP.NET Session State and JSP Servlet session storage is considered a transactional use.
 
All topologies are good for reference data but only some topologies are good for transactional data. You need to determine how many updates you'll be doing to figure out which topology is best for you. Below is a list.
 
Mirrored Cache
 
A Mirrored Cache is a 2-server active/passive cache cluster. In mirrored cache there is one active and one passive node only and no client can connect with passive unless it is active. Primarily passive node is used to keep asynchronous backup of data. A mirrored cache has no clustering cost, besides it gives data reliability through backup. By default, ImportHashmap flag will be false as in this topology client is not aware of data distribution between servers.
 
  • Reference data : Good. Max 30000 reads/sec (1k size).
  • Transactional data : Good. Max 20000 writes/sec (1k size).
 
Replicated Cache
 
A Replicated Cache consists of two or more cache servers in a cluster (there is no limit for number of nodes however, recommendation is for maximum three). It is suitable for situations where transactional data usage is lesser than reference data usage. Performance can slow down in transactional data because updates are applied synchronously on all the other servers in the cluster. Moreover, performance can diminish when more nodes are added in cluster.  By default, ImportHashmap flag will be false.
 
  • Reference data : Good. 30000 reads/sec per server. Grow linearly by adding servers.
  • Transactional data : Not so good. Max 2500 writes/sec. Drops if you add 3rd server.
 
Partitioned Cache (no replication):
 
A Partitioned Cache is intended for larger cache clusters as it is a very scalable caching topology. It is suitable in cases where performance is your major concern but without reliability of data. If any cache server goes down, data will be lost of that node as there is no replication/backup of data. Client gets connected with each server and request is sent to the targeted server only because client is aware of data distribution flanked by servers. By default, ImportHashmap flag will be true as client is data aware.
 
  • Reference data : Good. 30000 reads/sec per server. Grow linearly by adding servers.
  • Transactional data : Good. 25000 writes/sec per server. Grow linearly by adding servers.
 
Partition-Replica Cache (with replication):
 
Partitioned-Replica topology is combination of Partitioned topology and Replicated topology. It gives high performance with Reliability of data through replication and scalability through partitioning. It is suitable in cases where performance is major concern without fear of data loss. Partitioned-Replica provides both sync and async replication whereas, async replication is the default option. Async replication is quick for the reason that user doesn’t have to wait for operation to be done on replica as well. By default, ImportHashmap flag will be true.
 
  • Reference data : Good. 30000 reads/sec per server. Grow linearly by adding servers.
  • Transactional data : Good. 20000 writes/sec per server. Grow linearly by adding servers.
 
There is some overlap between Mirrored Cache and Partitioned-Replica Cache for 2-server clusters because both provide similar performance with replication. But, Mirrored Cache accommodates situations where you only have one dedicated cache server and the mirror server is being shared with other apps. But, if you have a need for 3 or more cache servers, then Partition-Replica Cache is the best choice for transactional use.
 
 
It is recommended to create a cache of at least 20% greater size than the actual data size. 
 
 
 
For more details, either see Caching Concepts - Cache Topologies  or visit Caching Topologies on our website.
 
 
  See Also