# Adaptive Data Synchronization Algorithm for IoT-Oriented Low-Power Wide-Area Networks
## 4 Adaptive File Synchronization
### On Double Signature Efficiency
Second, the reference signatures self-generation approach allows a significant reduction of \(D_{r}\), therefore making the \(\mathcal{E}_{rx}\) negligible with respect to \(\mathcal{E}_{tx}\). Therefore, we show that \(\mathcal{E}_{tot}\) becomes mainly dependent of \(\mathcal{E}_{tx}\)Battery-supplied DIoTs are typically designed for sporadic data transmissions, thus remaining idle for most of time, except for narrow active mode time windows. Time and energy spent in both these possible states allow the device battery lifetime to be measured as [38]:

\[L(t_{e})=\frac{C\cdot SF}{\mathcal{E}_{tx}(t_{e})+\mathcal{E}_{bg}} \tag{9}\]

where \(C\) and \(SF\) is the battery capacity and safety factor, respectively, \(\mathcal{E}_{tx}\) the average energy consumption component taken from Equation (8) and \(\mathcal{E}_{bg}\) the DIoT background electronic hardware consumption. Both \(\mathcal{E}_{tx}\) and \(L\) are averaged on \(t_{e}\), representing the time interval between two consecutive data transmissions (that is, two file synchronization events). Finally, we would like to remark that the power consumption analysis here reported has been rephrased to consider those aspects characterizing the file synchronization at the application layer. Moving down towards the network access layer, cloud-DIoT handshaking mechanisms and data framing are performed. Moreover, each specific layer protocol considers the introduction of additional information. Therefore, as the weight of \(D_{s}\) and \(D_{r}\) might be different from the one considered for our purpose, the model in Equations (8) and (9) should be conveniently handled. However, since \(\Delta\) represents the largest part of the total amount of data exchanged between two nodes, we believe that the proposed analysis may help to emphasize the importance of an efficient data synchronization protocol, especially in low-power IoT scenarios. ## 6 Numerical Results

The performance of the proposed AC-_rdiff_ and AH-_rdiff_ algorithms have been evaluated in terms of generated data traffic amount and DIoT power consumption. To this aim, we have developed a MATLAB-based simulator where the file synchronization between two parties, e.g., a DIoT and the Cloud, has been implemented. Specifically, first a byte string \(A\), representing the file stored at cloud side, is created. Then another string, namely \(B\), equal to \(A\) except for some modified parts, is generated. \(B\) acts as the file at DIoT side, so \(A\) is updated to \(B\) by resorting to different synchronization algorithms. Simulations have considered files, the dimension of which is equal to 3 kB. Taking into account the discussion reported in Section 1, the choice of such file dimension makes the simulation framework fairly realistic with respect to the scenarios described in Table 1 where limited-size data are handled (the file may represent some kind of measure coming from a sensor, or it may contain multiple information collected within a time interval but to be sent only at specific time hours of the day). Specifically, we have implemented file synchronization according to the following algorithms:

* \(rsync_{32,128}\): the classic _rsync_ mechanism as in [23] that considers the use of a 32-bit rolling checksum and a 128-bit MD5 hash, with a static chunk size equal to 500 bytes. * \(rdiff_{32,128}\): the algorithm parameters are the same used in [23], except for the chunk size that is set to 40 bytes, so letting the double signature provide a compression ratio \(r_{c}=2\) (the name _rdiff_ is used only to differentiate the current algorithm from the previous _rsync_). * \(rdiff_{16,64}\): as the dimension of the files to be synchronized is limited, two smaller signatures are considered, a 16-bit rolling checksum and a 64-bit cyclic redundancy check respectively, with the chunk size equal to 20 so to obtain \(r_{c}=2\).