# A Multilayer Data Processing and Aggregating Fog-Based Framework for Latency-Sensitive IoT Services
## 1 Introduction  
Fog computing is as a promising technology that has been emerged to handle the growth of smart devices as well as the popularity of latency-sensitive and location-awareness Internet of Things (IoT) services [1, 2, 3, 4, 5, 6, 7]. After the emergence of IoT-based services, the industry of internet-based devices has grown. The number of these devices has raised from millions to billions, and it is expected to increase further in the near future [8]. Thus, additional challenges will be added to the traditional centralized cloud-based architecture as it will not be able to handle that growth and to support all connected devices in real-time without affecting the user experience. IoT data that needs analysis, storage and processing are transferred to the data centers of the cloud. Because of the cloud centralized architecture, sending such data may not be efficient, or even not feasible in some cases due to the bandwidth constraints [9]. Moreover, the emergence of latency-sensitive and location-aware IoT services issues additional challenges as the distant cloud is not suitable to meet the ultra-low latency requirements of these services, support location-aware applications, or scale to the magnitude of the data that these applications produce [9]. To address these challenges, fog computing extends the paradigm of the cloud by utilizing the capabilities of edge devices and users' clients to compute, store, and exchange data among each other and with the cloud [10]. It shifts parts of the computations, communications, and resources' caching from the remote cloud to the network edge. Fog computing enables an innovative mixture of IoT-based services and applications for end-users as it effectively reduces both the service delay and the traffic loadby empowering end User Equipment (UE) with multitier computing or service. Therefore, data can be processed, and services can be provided flexibly at different tiers that are closer to UEs. The fog server possesses computational power and storage to provide real-time delivery of data and to support latency-sensitive applications while maintaining satisfactory quality services. In contrast to the cloud architecture, fog computing deploys small routers, servers, switches, access points or gateways that require less space to occupy. Thus, fog nodes can be located and distributed close to IoT clients allowing latency to be reduced and location awareness services to be supported. Fog nodes are deployed in a decentralized manner, widely spread and distributed, as well as geographically available in large numbers. Additionally, data filtering and connection aggregation are supported by fog computing. Compared to the cloud, the cost of the fog server is usually lower than that of the cloud as high availability of computing resources at relatively high-power consumption will be provided by the cloud, whereas moderate availability of computing resources at lower power consumption will be provided by the fog computing. Research in the field of fog computing is relatively new but is increasing very quickly [11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22]. Researchers have to consider the challenges arising from the huge number of IoT devices and their interactions, different technologies and distinct applications. Therefore, frameworks and models that simulate the actual fog system have to be developed and designed to overcome these challenges. This work proposes a Client-Fog-Cloud (CFC) multilayer data processing and aggregation framework to promote real-time interaction, wide distribution, massive uploading, and latency-sensitive services in an IoT context. The proposed framework consists of the device gateway, the fog server and the cloud. The device gateway collects data from clients and uploads it to the nearest fog node. Received data will be pre-processed and filtered by the fog server before being transferred to the cloud.