# Adaptive Data Synchronization Algorithm for IoT-Oriented Low-Power Wide-Area Networks
## 4 Adaptive File Synchronization
### On Double Signature Efficiency
* AC-_rdiff_\({}_{16,64}\): the proposed algorithm uses a 16-bit rolling checksum and a 64-bit cyclic redundancy check as signature, while the chunk size is dynamically adapted (the step size in Equations (1)-(3) was set to \(\mu=0.5\)). * AH-_rdiff_\({}_{16,64}\): based on the chunk size returned by the adaptive algorithm (\(\mu=0.5\)), either a signature-based approach with a 16-bit and 64-bit signatures or a signature-free procedure is used. All the algorithms listed above are implemented within a synchronization framework where the DIoT calculates by itself the reference signatures without receiving them from the cloud (an exception is represented by the very first synchronization event when the DIoT is initialized with the reference signatures coming from the cloud). ### Data Traffic Performance

Figure 6 shows the amount of generated data traffic for the considered synchronization algorithms, expressed as a percentage with respect to the entire file dimension (having 100% of generated traffic means essentially that the DIoT is sending the whole file to the cloud). The changed bytes have been individually, randomly sorted within the file \(F_{DIoT,t}\). The results, averaged over 100 simulations, are a function of the file update percentage, indicating how much the current file \(F_{DIoT,t}\) is changed with respect to its previous version \(F_{DIoT,t-1}\). As expected, \(rsync_{32,128}\) is completely inefficient as the chunk size \(d=500\) bytes is too large with respect to the entire file dimension. In fact, it is very hard to find matching chunks, especially when the update percentage grows. On the other hand, \(rdiff_{32,128}\) and \(rdiff_{16,64}\) show better performance since the considered chunk size is much smaller than in 500 bytes. However, in both cases the generated data traffic reaches 100% rapidly as the update percentage of the file increases. Finally, AC-\(rdiff_{16,64}\) and AH-\(rdiff_{16,64}\) provide best performance thanks to the fact that the chunk size is dynamically tuned according to the measured update percentage. This fact can be appreciated especially for high update percentages, where other fixed chunk size-based algorithm are inefficient. As explained in Section 4.2, the AC-\(rdiff\) algorithm considers a lower bound regarding the minimum chunk size, while AH-\(rdiff\) has no constraints since if the chunk dimension is lower than the signature sum size, the system simply switches from the signature-based to the signature-free approach. For this reason, AH-\(rdiff_{16,64}\) is better performing than AC-\(rdiff_{16,64}\). The same analysis reported in Figure 6 has been performed considering a different scenario where the updated bytes within \(F_{DIoT}\) are characterized by a burst distribution, the dimension of which is sorted following a Gaussian probability density function with mean \(\mu_{burst}=5\) and variance \(\sigma_{burst}^{2}=6.25\) (the size of new byte chunks ranges from 2 to 15 bytes). From a data synchronization point of view, this latter case is more favorable than the previous one where the bytes to be changed were individually and randomly distributed since, for a given update percentage, having a more compact distribution of the updates returns a higher possibility to find matching chunks, thus reducing both the processing time and the amount of bytes to be transmitted to the cloud. This fact is confirmed by the results in Figure 7 where it is possible to observe how all the considered algorithms show better performance with respect to the previous case of Figure 6. However, the higher efficiency of AC-\(rdiff\) and AH-\(rdiff\) mechanisms is clearly evident even in this scenario. Figure 6: Performance of the considered file synchronization algorithms as a function of the file update percentage. Random update distribution within the file is assumed. Finally, we have simulated 30 consecutive file synchronization procedures, reporting in Table 2 the average traffic percentage generated according to the algorithms under investigation.