In addition, by increasing the size of the data, the network performance will deteriorate. Furthermore, since in a conventional cloud computing-based service, the computation processes need to be uploaded to the cloud servers that are already far from the end users, and the limited bandwidth and network resources are occupied by massive data transmissions, there will be large latency within the networks. In time-sensitive IoT applications, meaning that they require very short response times, such as smart transportation [11], smart electricity grid [12, 13], smart city [14, 15, 16], etc., large latency is more critical, and it is unacceptable. This is an important issue for IoT since these applications will have an impact on safety and emergency response. Moreover, most IoT devices (smartphones, wearable watches, etc.) still have fundamental challenges such as limited memory size and limited battery life. Balancing power consumption by transferring the energy-consuming computation tasks of applications to devices that have higher power and computational capabilities is necessary to be able to extend the battery life of devices. In addition, processing data in computation nodes with a short distance to the end user will reduce transmission time, leading to a reduction in power consumption. In contrast, in cloud computing-based services, network traffic affects the data transmission speed, and heavy traffic results in long transmission times, therefore increasing power consumption costs. Hence, offloading the energy-consuming computation of applications to the edge of networks [17] is a critical issue that should be considered in order to extend the battery life of IoT devices. Recent research has investigated the effective exploitation of capabilities at the edge of networks in order to support IoT and its requirements [9]. In edge computing (EC), computing and storage of massive data produced by different types of IoT devices can be performed at the network edge close to the user instead of transferring them to a centralized cloud infrastructure [18, 19, 20, 21, 22, 23, 24, 25, 26]. Since the locations of edge computing nodes are close to end users, the peak in traffic flows will be reduced. In addition, the bandwidth requirements of the centralized network and the transmission latency during data computing or storage in IoT will be significantly mitigated. Distributing computation nodes deployed at the edge allow offloading of traffic and computational pressure from the centralized cloud, and it provides faster response times for IoT applications and greater quality services in comparison with cloud computing. Reducing the overall delay of the system and the demand for communication bandwidth is very efficient and would improve the overall performance of the system. Transferring the data directly to the cloud platform requires substantial operational costs for data migration, good bandwidth, and delay characteristics. By reducing data uploading volume in EC-based IoT, data migration volume, bandwidth consumption, and latency will be reduced; therefore, operational costs will be decreased accordingly. Another advantage of edge computing is protecting data security and privacy [27, 28, 29, 30]. Even though cloud platform service providers offer a comprehensive system of centralized data security protection solutions, if centralized stored data becomes leaked, it will have serious consequences. Edge computing in IoT allows deploying the most appropriate security solutions in the local vicinity, so it reduces the risk of data leakage during transmission, as well as the data volume stored in the cloud platform; therefore, security and privacy risks will be minimized. Furthermore, in edge computing, the computational and communication overhead from IoT devices with limited battery or power supply will be migrated to edge nodes with significant power resources. Therefore, the lifetime of the IoT devices with a limited battery will be extended, resulting in an increased lifetime of the entire IoT network.