# Elastic Computing in the Fog on Internet of Things to Improve the Performance of Low Cost Nodes
## 5 Test Bed for Soundscape Monitoring and Its Performance Analysis
### Performance Evaluation of the Cluster in the Fog  
Now, we will focus on the cluster and its capabilities. We performed the same calculations as before, but embedding all the parameters within the same container, in order to measure the total throughput of the whole cluster, comparing Swarm and Kubernetes, with the aim of measuring its performance. We will refer to the concept of Docker stacks from Swarm as _Pod_ as in Kubernetes, since both are equivalent. We used the same testbed as before, with one client node recording audio chunks and the cluster (the SUT) processing all of them. The cluster was set up with four RPi 3B, one node acting as a master and three slaves. We embedded all the parameters within the same container and the master distributed this container among the slaves and their different _Pods_. In the testbed, the external client timestamped each audio chunk and sent it to the master by WiFi on the mesh network at a certain rate (\(\lambda\) or audio chunks per second). The master distributed the audio chunks among the slaves by WiFi too. The slaves were running a REST-API and received requests from the master. The slaves kept the audio chunks assigned temporarily, if they were busy (while working with other audio chunks), in a FIFO queue implemented internally in the REST-API implementation. If the audio chunks had to wait for processing, the queuing time depended on the number of pending audio chunks. Each slave processed their assigned audio chunks one by one and sent the results (acoustic parameters and PA) back to the master, every time an audio chunk was processed. The master forwarded them to the client. Once the client received each result, it measured \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & **Type** & **L** & **S** & **R** & **F** & **PA (Total)** \\ \hline Matlab & _Computer_ & 0.058 & 0.000 & 0.288 & 0.404 & 0.699 \\ C++/Python & _Computer_ & 0.003 & 0.000 & 0.128 & 0.235 & 0.238 \\ RPi3B & _Single node_ & 0.018 & 0.000 & 0.849 & 0.742 & 1.479 \\ RPi3B+ & _Single node_ & 0.017 & 0.000 & 0.794 & 0.694 & 1.406 \\ RPi3B & _Cluster_ & 0.022 & 0.000 & 0.853 & 0.754 & 0.875 \\ RPi3B+ & _Cluster_ & 0.021 & 0.000 & 0.802 & 0.703 & 0.824 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Time comparison in seconds to calculate the psycho-acoustic parameters (loudness (L), sharpness (S), fluctuation strength (F), roughness (R), and PA (total time)), among different devices and programming languages using different types of approach: a computer (base line), a single node (RPi), and a cluster with four RPis (fog computing approach). the total computation time, as before. It must be stressed that each computation time per audio chunk includes: the sending time from the client to the master and from the master to the slave. As seen in Table 1 in a RPi3B, each audio chunk takes an average of 1479 ms to calculate PA, with a standard deviation of \(1.405\times 10^{-4}\) (it is near a deterministic time). If we consider 1479 ms, as the average service time, equal to \(\frac{1}{\mu}\), the service rate (\(\mu\)) is 0.676 chunks/second. Besides, we will call the number of available _Pods_\(c\). The number of _Pods_ is defined by configuration before hand at each slave in the cluster. In this case, we can model this approach as \(D/D/c\) according to the Kendall notation. That is, a deterministic arrival process (since audio chunks are recorded one per second) and a deterministic time service with \(c\) cores (number of _Pods_). Because each RPi had four cores, while in the cluster we had one, two, or three slaves, we got four, eight, or 12 cores, maximum. Each core can run a _Pod_. Thus, with one slave \(c\) is in the range \([1,...,4]\); with two slaves \(c\) is within \([2,...,8]\); and with three slaves \(c\) is within \([3,...,12]\). In particular, we evaluated the performance of the cluster with and without congestion. On one hand, if \(\lambda\geq c\cdot\mu\), we have congestion. In this case, each slave running a REST-API will keep the audio chunks in RAM memory.