NCache 4.4 - Online Documentation

Overview

 
There are scenarios when it is more feasible to fetch/update cache data in bulk. For example, an application can load customer information in bulk in the start. Bulk operations are desgined to get better performance as they are executed as a single operation on the server. Retrieving 100 cache items in a single bulk operation performs many folds faster than retrieving them through 100 individual Get calls.
 
Failures in Bulk Operations: Although bulk operation executes as a single operation, failure of operations constituting the bulk operation are treated individually, e.g., if a bulk add operation is performed with 100 cache items and 20 cache items already exist in the cache, then only those 20 cache items will not be added to the cache. The remaining 80 cache items will be added to the cache. Bulk operation returns a dictionary of failed operations.
 
Avoiding Large Bulk Operation: There is no limit on how many operation can be combined in a single bulk operation. But it is recommended to avoid larger bulk operations as it can raise the memory usage on both applications and cache servers due to serialization/desrialization of large amount of cache data in a single cache  operation request/response.
 
How Bulk Operations Work
Bulk operations behave in different ways for different topologies. Therefore, in the following paragraph, topology specific working of bulk operations is discussed.    
 
  • For MirrorĀ and ReplicatedĀ Cache
In mirror topology, there is one active node and one passive node. The client only communicates with active node, while passive node is the replica of active and is used for backup facility. In replicated topology, there are more than two nodes and all of them are active. So write operations are performed in parallel on all these nodes.
 
Bulk operations in these topologies, are sent to the specific node where the client is connected. Thus the bulk operation boosts performance by decreasing network trips to remote server.
 
  • For Partitioned and Partitioned-Replica Cache
Bulk operations are optimized in case of partitioned or partitioned-replica topology. In these topologies, the key-distribution map is maintained to distribute keys over multiple nodes. On the client side, this map is used to optimize bulk operations.
 
When data is updated or fetched; bulk operation bundles the collection of key-value pairs based on the key-distribution map. These bundles are sent to particular nodes on remote server. On getting a response, bulk operation merges these responses and return the accumulative result to the client application. Thus, optimizing the operations and increasing the performance of application.
 
 
See Also