# Fog-Based CDN Framework for Minimizing Latency of Web Services Using Fog-Based HTTP Browser
## 4 Implementation and Experimental Results
### Experiment Setup and Results
#### 4.2.1 Single Fog Node and Single Consumer Experiment  
Our first experiment was conducted on a local network with one Raspberry Pi 3 Model B Plus attached to the network as a fog node. The Raspberry PI had the _FW_ tool installed and running. A MacBook Pro with a 2.9 GHz Dual-Core Intel Core i5 processor was attached to the network as an edge device with the Fog Browser ready for sending consumer requests. The _FR_ API and database were deployed on a cloud server located in Amsterdam, the Netherlands, provided by cloud provider DigitalOcean ([[https://www.digitalocean.com/](https://www.digitalocean.com/)]([https://www.digitalocean.com/](https://www.digitalocean.com/)) accessed on 6 November 2021). On this server, we installed Kong API Gateway with the _FSL_ as a plugin enabled. A NATS ([[https://docs.nats.io/](https://docs.nats.io/)]([https://docs.nats.io/](https://docs.nats.io/)) accessed on 6 November 2021) server was installed on the same server as well. This full installation was used to ensure the framework's completeness and integrity. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Command Line** & **Command Syntax** & \multicolumn{2}{c}{**Responsibilities**} \\ \hline  & - & _FR_ registration. \\
**Join the Network** & \$\textgreater{}\textgreater{}\textgreater{}\textgreater{}_/fog-node joint-network_ & - & Joining nearby FNs. \\  & - & Subscribing to event channels. \\  & - & Pulling resources when published. \\ \hline
**Acknowledge Joiners** & \$\textgreater{}\textgreater{}\textgreater{}_/fog-node acknowledge-joiners_ & - & Replying to the new Fog Browser discovering the network. \\ \hline
**Serve resources** & \$\textgreater{}\textgreater{}\textgreater{}_/fog-node cdn-server_ & - & Serving offloaded resources. \\ \hline \hline \end{tabular}
\end{table} 
Table 1: A summary of the _FW_ different commands. To evaluate the latency improvement, the experiment was conducted using the same local network setup with Raspberry PI and a MacBook Pro attached to the network. We manually offloaded the static resources of the studied websites to the fog node. We used Google Chrome development tools to export all the resources of each website. These resources were then offloaded to the Raspberry PI node, acting as a fog node. We targeted six websites in our study, chosen based on their Alexa ranking and their resource sizes. Table 2 lists the studied websites along with their resource sizes. The latency difference between a fog-based CDN and a cloud-based CDN was used as the metric to evaluate our framework enhancement made by offloading the resources in a fog node. The latency was calculated as the request response time to load the requested content. We conducted our experiments on the assumption that the fog nodes served more than one edge device. Using the Fog Browser, we assessed each of the studied websites three times in different time periods and measured the latency for both fog-based CDN and cloud-based CDN per run. The first measurement was carried out with the fog-enabled feature turned off, and the second measurement was carried out with fog-enabled feature turned on. While the fog was turned off, the Fog Browser retrieved the websites' resources using the CDN cloud versions, whereas while the fog enabled feature was turned on, the Fog Browser retrieved the websites' resources using the fog versions offloaded to the nearby fog nodes. As shown in the bar chart in Figure 8, our experiments show that, with our proposed framework offloading autonomy, service latency can be reduced by 85%, and overall website user experience can be enhanced. In this experiment, we excluded the resource offloading time to the fog nodes. Our rationale behind this exclusion can be summarized in the following points:  
1. Traditional cloud CDNs geographically distributed around the world need to pull the resources of a given service to their servers. This means that there is also an off-loading time for these cloud CDNs.