1 Introduction

Internet of Things (IoT) has matured over with the passage of time. Now we can see IoT applications in many areas of computing and technology. In particular, IoT plays a critical role in the making of smart cities, which are now implemented on a large scale in the developed economies on the planet earth. A snapshot of IoT application is shown in Fig. 1. Basically, IoT is an information technology infrastructure which consists of sensors, actuators and advanced services for interconnecting physical and virtual world with the help of sophisticated communication technologies [1, 2]. Ubiquitous aspects of IoT have been studied with various perspectives in [3, 4].

Fig. 1
figure 1

Smart city applications

Most of the IoT based devices such as Smart-phones, Smart-watches, health monitoring, and drug delivery wireless devices are of limited power, storage, and computing capabilities. Therefore they rely heavily on the cloud data centers to collect huge amounts of sensed data and for analyzing it, in addition, to providing many of services and features to end user like accessibility, scalability, mobility, providing resources for storage and computation functions with low cost, etc. [5, 6].

With the ongoing research and innovations. Various weaknesses of the clouds data center have been exploited by various articles including [7, 8]. This research shows that the clouds based computing and data centers will not satisfy the increasing requirements of smart objects whose number is expected to exceed 50 billion by 2020. This explosion in the IoT objects adds to the delay and latency in applications, which will affect the quality-of-service (QoS) and the range of supported applications in use. Edge computing concept with several models has been proposed to overcome the limitations of Cloud and to expand the scope of services and applications that will be supported [9, 10]. The most important models are shown in Fig. 2 [11,12,13], some of whose details are as follows.

  • Local/Edge is a small cloud close to the end user in a specific area, which allows them to avoid dealing with a remote one like in Clouds. This type of system only has distributed overhead on the central cloud to few clouds where each one serves in a specific area.

  • Mobile Edge Computing (MEC) depends on servers dedicated to the Cellular Devices Stations to provide some new features and computing services for mobile subscribers. This type relies on the radio network.

  • Mobile Cloud Computing (MCC) is a model that relied on the new features and capabilities in the smartphones to do some processes on the local side, but if there is need to more power, the phone will send this task to middle layer (lightweight cloud servers named Cloudlet) between mobile computing (Smartphone) and cloud computing (the Central Cloud)..

  • The last model is the Fog Computing which is different and based on the new idea of the dense distribution of several Fog nodes close to end users to do some computation and storage tasks, and to be a broker between central cloud and smart objects.

Fig. 2
figure 2

Edge and mobile computing models

All previous models are found to offload the jobs of the cloud to the edge of the network to enhance the quality of services, lift the performance, decrease the latency, boost the connectivity, and support different types of projects which are sensitive to the time and critical cases [14]. Contributions of this research are:

  • Provide a brief introduction of Fog computing.

  • Provide realistic cases for using Fog with IoT apps.

  • Proposed a novel application of Fog for protecting the privacy of IoT based applications.

  • Discuss challenges and future trends.

Rest of this article is divided into five sections. In the Sect. 2, we discuss the details of Fog including its definition, properties, roles, applications in addition to comparison with the cloud. In Sect. 3, we shall show some real applications which are enhanced by Fog whereas. In Sect. 4, we shall focus on challenges in Fog technology and propose a new idea about using Fog for privacy protection, and in Sect. 5, we shall provide concluding remarks with future possibilities in this area.

2 Fog computing

  1. A.

    Definitions

    Fog is a recent distributed computing model, it was introduced by Cisco in 2012 as assistant to the cloud computing to enhance QoS and to develop different kinds of supported applications in IoT [8]. The meaning of Fog word explains the nature of this term, where the clouds are far in the sky, the Fog comes down on the ground close to people [15].

    Actually, there are many definitions for Fog focused on the same ideas, [8] said, Fog is new computing paradigm could be seen as an extension to cloud computing near network edge to reduce the burden on the cloud. Whereas the researchers in [11] defined Fog as a new computing model found to exceed the cloud problems, and in [7] defined Fog as an extension to cloud computing and services proximity to the user in the edge. In [10], Fog is a term coined to distribute data processing to the edge.

    Briefly, the Fog computing is a small cloud in the edge of network near to end user to do some preprocessing of data, applying some roles and policies, filtering some things, performing some issue, or caching some info before sending to the cloud to store it and make full analyzes. This neutrality for Fog has allowed it to provide new features and solve many limitations comparing to the cloud computing [16, 17].

  2. B.

    Comparison between cloud and Fog

    Cloud provides enormous amount resources and services to a client with low cost through three types/levels of services (levels of control) which are [8, 12]:

    • Software as a Service (SaaS) allows the user to get services from the cloud if it existed e.g. Software applications online, these applications are provided from the third party and the user only can use this service as manage your docs online.

    • Platform as a Service (PaaS) allows user to set and run his own application on the cloud to be accessed from anywhere at any time, as some companies applications will be deployed on the cloud to be available for their employees or customers without concern about resources, data security, and backups, management, etc.

    • Infrastructure as a Service (IaaS) user has control on specific parts of resources as operating system, network, and storage virtually by the Internet, e.g. some applications need High-Performance Computing (HPC) requirement to test their functions on big data, so they need direct control (Virtual) and privileges on some part of resource to manage and do what they want.

However, all these service levels worked on raw data after it reaches to cloud, and this data is very big, so that will adversely affect the link capacity, bandwidth, performance, etc.

For previously mentioned reasons, the Fog computing as edge model provided many methods to address these issues and contribute to enhance the quality of cloud and expand the range of services that can be introduced to end user [18, 19].

The main key features of Fog computing are:

  • Dense deployment for Fog nodes in the edge of network near to user enabled them to do some preprocessing on data (filtering, removing repetition, dealing conflict, aggregating, classifying) to convert it from raw data to smart data, that reduces the size of data and that will move on the link and offload the burden for cloud and provide location awareness [20].

  • Fog can take speed decision in the emergency cases before the data sent to the cloud and without delay or latency [21].

  • The Fog nodes can contribute to providing more mobility and availability of service even in the scenarios where an Internet connection is down [22].

  • Fog can apply the specific policy to data or encrypt data before sending to cloud, this is done to increase the security [23].

  • Fog can support new types of applications such as virtual reality and real-time applications [17].

We proposed new dimension of Fog which is related to its role in the privacy protection (more details will follow) [3, 24]. The structure of Fog and cloud is depicted in the Fig. 3.

Fig. 3
figure 3

Example of a figure caption

Generally, Fog computing consume less power than central computing in clouds. However, the main advantages of Fog, as shown in Table 1, is it’s with integration with cloud. By this cooperation, we save a lot of energy consumption [25, 26]. There are many companies, for example IBM, Google, Samsung, Intel, ARM, AWS, Azure IoT, which provide platforms for IoT applications and services. However the most of these platforms are cloud-based. Recently, most of them have also started to consider the fog as the dominant element in the platforms like Google, Microsoft, Amazon, IBM, and Cisco. The reason for doing this is to facilitate more services, reduce the cost of communication, and reduce the delay in response. The main services of all these platform are to manage devices and connectivity, data and storage, analysis and visualization, etc. At the same time the main applications are remote control facility and provide PaaS applications, ubiquity services, IB, and healthcare, and environment system [27, 28].

Table 1 Fog vs. cloud

Further comparison between both (Fogs vs. Cloud) is also presented in Table 1. Examples are provided in the next section to explain these differences, features, and properties [29].

3 Cases and examples of Fog usage

  1. A.

    E-health system

    It is one of the most important applications in the smart city. It tries to provide more high standards of healthcare and in emergency conditions using IoT infrastructure. This system asks the patient to wear special clothes or gadgets with sensors that monitor the heart rate, blood pressure, sugar rate, level of pollution in the air, temperature, etc.[30].

    All these information have to send to the cloud (server provider) to be collected and analyzed to detect any potential danger in advance. If there is any abnormal case, or health emergency is predicted, the patient will be notified in advance. Even some emergency calls will be done by calling family or ambulance.

    However, this system is very sensitive or latency, because it is related to people lives. Unfortunately, the cloud can’t achieve this requirement due to the scheduling of a huge number of functions which come to cloud in short period of time. For this, the Fog computing and serve an unlimited number of patients at the same time without affecting the latency.

    Fog nodes will be distributed densely in the city (smart city) and the patient can connect to any nearest node locally by wireless connection, and all this sensed data will send to Fog which will aggregate this data and classify it [31].

    Then it will collect statistical values for all cached data and then it will send only the aggregated values to the cloud to save permanently for historical analyses instead of sending huge details of data. This will save the bandwidth and capacity of the link, and enhance the performance; moreover, if there is an emergency case, the Fog can detect it directly without delay and take the right decision without the need to contact to the central cloud.

3.1 Face recognition system

Some companies use this system which relies on the cloud which contains all data about their employees to do the computation functions, return the result and record attendance instead of buying their own system. So each employee will send his image to the cloud to process it and which will apply an algorithm and then return the result [32].

However, if there are a big number of employees and each one will send his image on a link that will cause a lot of latency and overhead on the network and cloud itself. Using Fog will solve this problem by performing some functions on the image before sending. Fog node will do a features extraction task on the image and then send these few values to the cloud instead of the whole image. That will save the resources of the network and offload the tasks from the cloud. Similar ideas can be used in video conference systems, virtual reality, e-learning, etc.[33].

  1. B.

    Traffic organization system

    These systems need speed response and tools to collect data and calculate traffic in each street quickly and then notify the automobiles about the best path. That system will be inactive without Fog nodes, which can be set in the traffic light or in the smart cars. The cars will send the signals continuously to the nearest traffic light (Fog node) [34].

    This node will calculate the objects number, and then it will send this value to the cloud which aggregates all values, takes a decision and resends notifications to Fog nodes. Finally, Fog nodes pass them to vehicles. Another scenario in similar systems is, the smart vehicles can cooperate together to perform the same goal [3].

  2. C.

    Energy control system

    In the smart home, all devices send a signal in every few seconds to the server provider (cloud) to calculate the rate of consumption of energy, but that causes congestion on the networks and enables cloud to aggregate very specific information about the lifestyle of users to give him reports about his devices and their usage energy [5, 35].

Fog node also can be used here to cache data and finding the average amount of consuming for each device and then send it to the cloud without sending all values with specific times which isn’t required and maybe reveal sensitive information about the user. That will enhance the performance and save the network and cloud resources.

Actually, there are many other applications that Fog can have positive effects and make them more sophisticated as Mobile-Learning [36, 37], Decision-Making [38], E-government [39], Shopping [40], Management in Crowded Event [41], etc.

4 Fog computing, challenges and opportunities

  1. A.

    Challenges

    Actually, there are many of challenges inherited from the cloud computing and other related to nature of Fog itself [8, 20, 23, 42]. Some of the main challenges are:

    • Security challenge.

    • How to protect the Fog node from an outside attacker, or from malicious Fog node.

    • Heterogeneity of devices that connect to Fog created a real challenge on it.

    • Creating a standard framework and protocols to manage the Fogs and IoT objects.

    • Managing the collaboration between Fog nodes themselves.

    • Programming Fog and finding standard programming language to enable the developer to achieve their tasks easily.

    • Privacy of users and objects data, where the most of researches considered Fog as a reason for violation privacy, while we proposed many scenarios employed Fog properties to protect privacy as a new dimension of using Fog computing.

      The concept of privacy is different from security and it is more complex, the security concerns about protecting data on the link between two sides user and server provider, or protect user and server provider themselves, while in the privacy, user sends his data to server provider and at the same time he doesn’t trust the server provider, so wants to protect his sensitive data from it [3].

      Many traditional approaches have been provided in this domain as K-Anonymity, Obfuscation, Dummies, Cooperation, etc. but these approaches had some open problems until now in performance, the accuracy of results, and need to trust in a third party. In addition, they are not suitable for many of smart city applications [24, 43].

  2. B.

    Opportunities

    As we mentioned in the previous sections, the Fog has to integrate with the cloud to enhance the provided services, and to pave the road for creating new services in various major areas. Also, we proposed a novel idea of using Fog computing to find new techniques to protect privacy.

First technique can be used in case of E-Healthcare systems [44, 45]. It is dependent on the Fog’s capability to be a blind broker between users and cloud to hide user’s identity. Where user encrypts his data plus his random key and sends it to Fog to hidden his identity from the cloud without disclosing his information, also the response will be encrypted by using a random key.

Second technique depended on the capability of Fog to perform some processing as (B- face reorganization system), where Fog calculates the features of the image and sends them instead of the original image that means preserving personal information from the cloud [45, 46].

Third technique depended on the cooperation between Fogs themselves to protect user location without affecting the quality of system as (C- traffic system), here each two Fog nodes can exchange the locations of two users and then send it to cloud which will collect false information about each user without changing the total number of vehicle in each area [47, 48].

Fourth technique depended on the caching property in Fog node, so it is can store some of the users’ query answers to use them in answering future queries without connecting to server provider [49, 50]. Finally, the last idea can integrate with any of other previous ideas to form new effective methods.

5 Conclusion and future trends

In this paper, we have presented an overview of IoT and computing models especially the Fog computing, its properties and features. We have also provided a comparison between cloud computing and Fog in some important applications. Our discussion of cases of applications using Fog clearly demonstrates benefits of Fog in IoT based applications.

Finally, we have listed and discussed most of the limitations of Fog computing with a focus on privacy. In addition, we have floated some ideas of using Fog to enhance new methods of preserving privacy.

In summary, some of the future trends in Fog computing can listed as:

  • Create a standard framework to manage IoT objects, Fog nodes, Cloud, and relations among them.

  • Find uniform protocol for connecting between users and objects, and Fog nodes.

  • Develop new approaches to enhance security and privacy protection which is considered the biggest challenge faced by IoT based applications.

  • Enhance the resources of Fog nodes and employing them in new applications.

  • Find simulation tool, and Fog dedicated programming language to deal with Fog nodes and manage the cooperation between these nodes.