# Bindings and RESTlets: A Novel Set of CoAP-Based Application Enablers to Build IoT Applications
## 6 Implementation and Evaluation
### Packet Size
#### 6.4.2 Performance Evaluation of RESTIet  
Several tests were conducted to evaluate the performance of RESTIets. In all tests, we considered latency to be the most important performance factor that needs to be compared. We used different topologies, number of nodes, and data processing entities. A. Impact of RESTIets  
Data processing performed in the LLN by RESTIets introduces delay but reduces the number of packets in the network. We used a fixed topology (Figure 18) to mathematically evaluate the impact of RESTIets at the RESTIet node (labeled RN in the figure). In this scenario, data may be sent from the sensor nodes, labeled S, and pass through the RESTIet node before going out to the LLN gateway or the cloud. We compared the RESTIet case, where processing is done by the RESTIet node and No-RESTIet case, where the processing is done elsewhere (at the gateway or in the cloud). In the No-RESTIet case, node RN is used as a router only. Whenever a packet arrives, it just processes it in order to determine the next hop address after which it is forwarded to the next hop. Therefore, in the No-RESTIet case, the total packet processing and forwarding time at the node RN is given by:  
\[T_{p}\,=\,T_{x}\,+\,TF_{1}\,+\,(TD_{1}\,+\,T_{x}\,+\,TF_{2})\,+\,\ldots\,+\,(TD _{n}\,+\,T_{x})\]  
where:  
* \(T_{p}\) is total packet processing and forwarding time. * \(T_{x}\) is packet processing time (from the experiment we found out that this value is 6 ms)
* \(TD_{i}\) is time delta between the arrival of two consecutive data packets from two different senders (if only 1 data sender, this value is 0). This value is variable. * \(TF_{i}\) is Packet forwarding time (calculated as the arrival time of the packet at the next hop minus the time the packet was ready to be sent out). This value is also variable. Figure 18: Network Topology. So for \(n\) data generating nodes;  
\[T_{p}=\left\{ \begin{array}{ll}T_{x}+\ TF_{0},&n=1\\ T_{x}\times n+\sum\limits_{i=2}^{n}TD_{i}+\sum\limits_{i=1}^{n}TF_{i},&n>1\\ \end{array} \right.\]  
On the other hand, in the _RESTlet case_, the node is expected to do other processing too. First of all, it has to unpack the CoAP packet to get the data and store it provisionally. Secondly, it waits for subsequent packets if more than one data sender node exists. Thirdly, it has to perform processing and generate output. Finally, a new packet is generated and forwarded to the next hop. Therefore, the total packet processing and forwarding time at the RESTlet node, \(T_{p}\), is given by:  
\[T_{p}\ =\ T_{x}\ +\ (TD_{1}\ +\ T_{x})\ +\ \ldots\ +\ (TD_{n}\ +\ T_{x})\ +\ T_{NPG}\ +\ TF\]  
where:  
* \(T_{p}\) is total packet processing and forwarding time. * \(T_{x}\) is packet processing time. (From the experiment, we found out that this value is 22 ms and the RESTlet function we considered was AVERAGE. Other processing functions may yield different results). * \(TD_{i}\) is time delta between arrivals of two consecutive data packets from two different senders (if only 1 data sender, this value is 0). This value is variable. * \(TF\) is packet forwarding time (calculated as the arrival time of the packet at the next hop minus the time the packet was ready to be sent out). This value is also variable. * \(T_{NPG}\) is time required to generate new packet (from the experiment we found out that this value is 14 ms). So for n data generating nodes,  
\[T_{p}=\left\{ \begin{array}{ll}T_{x}+\ T_{NPG}+TF,&n=1\\ T_{x}\times n+\sum\limits_{i=2}^{n}TD_{i}\ +\ T_{NPG}+TF,&n>1\\ \end{array} \right.\]  
In order to compare both results, we can say that \(TD_{i}\) is the same for both cases and can use an average constant number for simplicity. However, the value of \(TF_{i}\) is different among different packet transmissions. From the experiments, we observed that the data forwarding interval ranges between 20 ms and 140 ms. Moreover, all experiments showed that the processing time at node RN, \(T_{x}\), is 6 ms and 22 ms for the No-RESTlet case and the RESTlet case, respectively.