## 7 Quadratic Adaptive Replication (QAR)  
Multi-replication is one of the most important research lines of DCS. In particular, ToW [32] is one of the most interesting works because it is the only one that has presented a model that provides the optimal number of replicas to be used based on network traffic. ToW is based on a geometric replication formula, that calculates the number of replicas, \(N_{r}=4^{d}\), being \(d\) the so called network-depth. Once the optimal \(d\), \(d^{*}\), has been defined, the number of replicas to be used is also known. The main drawback of this replication scheme (that is also used in GHT with multiple replicas [30; 31]) is that it is not very flexible because the number of replicas could be only one among these values: 1, 4, 16, 64, 256, 512, 1,024, _etc_. Therefore, there could be cases where, for instance, neither 16 replicas nor 64 are the optimal value, but some other value in between.  
In order to provide a more flexible solution that allows to select a more adaptive number of replicas,  
Figure 6: Multi-replication grid in Quadratic Adaptive Replication (QAR).  
we have designed the Quadratic Adaptive Replication (QAR) scheme, where the number of replicas, \(N_{r}\), follows a quadratic formula, \(d^{2}\). QAR is also a grid-based replication scheme that uses the combing routing used in ToW (explained in section 5.3.). QAR is demonstrated to be much more adaptive than ToW, since now the number of replicas that can be selected is: 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, _etc._ Figure 6 shows an example of QAR for \(N_{r}\) = 9 and 16. It must be noted that ToW does not have the option of using 9 replicas, but jumps from 4 to 16.  
We also present an alternative model to the one of ToW that provides the optimal number of replicas to be used in order to minimize the overall network traffic. Our model considers the same cases proposed in ToW: when the traffic related to queries overpass the one generated by events (\"consumption dominates production\") and the opposite case (\"production dominates consumption\"). These cases are the same described in ToW as \"write-all-query-one\" and \"write-one-query all\", respectively.  
Therefore, when there are many consumer queries (consumption dominates production), it is worthy to replicate the few producer events in all replicas using the combing routing, while consumers only need to access the closest replication node in order to retrieve all the data. On the other hand, when there are few consumers queries (production dominates consumption), replicating all data as in the previous case is quite inefficient. Instead, in this case producers just store the events in its closest replica while consumer queries need to reach all replication nodes using the combing routing in order to retrieve all the data of an event type.  
Finally, it must be noted that our mathematical model provides an optimal number of replicas that is a real number (this also happens in the ToW model). Thus, we evaluate the overall traffic cost for the immediate higher and lower integer number obtained from the quadratic series 1, 4, 9, 16, 25 _etc._ For instance if the model output is \(N_{r}^{*}=29.31\), we evaluate the traffic cost with \(N_{r}=25\) and \(N_{r}=36\) and select as number of replicas the one providing the lower traffic cost. It must be noted that in the same case ToW could only choose among \(N_{r}=16\) or \(N_{r}=64\).