Bachelors Program in Electronics and Communication
IoT and Embedded Systems
•
Post Graduate
Cloud, Edge and Fog Computing for IoT
Introduction and Context
The Internet of Things (IoT) connects sensors, actuators, embedded controllers, gateways, networks, software platforms and human users. A typical IoT deployment produces continuous streams of data and must often respond within strict limits on latency, energy, privacy and reliability. Sending every measurement to a distant cloud is convenient, but it may be unsuitable for industrial control, autonomous vehicles, healthcare monitoring or safety-critical infrastructure. The architectural response is to distribute computation across three complementary locations: the cloud, the edge and the fog.
Cloud computing provides elastic, centralized storage and computation. Edge computing places processing close to data sources or actuators. Fog computing provides an intermediate, distributed layer between edge devices and centralized cloud services. These are not mutually exclusive technologies; a well-designed IoT system commonly uses all three.
Learning Objectives
After studying this chapter, a learner should be able to:
Explain the architectural roles of cloud, edge and fog computing.
Compare the three paradigms using latency, bandwidth, cost, resilience, security and scalability.
Design an IoT workload-placement strategy.
Apply latency, bandwidth and energy models to deployment decisions.
Explain virtualization, containers, orchestration and distributed data management in IoT.
Evaluate security, privacy, governance and sustainability implications.
Analyse a practical IoT architecture and justify its design choices.
1. The Distributed IoT Computing Continuum
A useful abstraction is the computing continuum. At one end are constrained sensors and microcontrollers; at the other are large cloud data centres. Between them are gateways, industrial PCs, access points, cellular base stations, enterprise servers and regional micro-data centres.
1.1 Cloud computing
Cloud computing offers on-demand access to shared configurable resources—compute, storage, databases, networking and software—through a network. Its principal characteristics are:
elastic scaling;
centralized management;
high-capacity storage;
broad service availability;
resource pooling and measured usage; and
access to advanced analytics and machine-learning infrastructure.
Cloud services are commonly classified as Infrastructure as a Service (IaaS), Platform as a Service (PaaS) and Software as a Service (SaaS). In IoT, managed message brokers, time-series databases, digital-twin platforms, stream processors and model-training services are frequently delivered through PaaS or SaaS.
Cloud computing is especially appropriate for historical analysis, fleet-wide optimization, model training, archival storage, device management and applications whose latency tolerance is relatively high.
1.2 Edge computing
Edge computing moves computation and storage toward the point at which data is generated or consumed. An edge node may be a smart sensor, gateway, industrial controller, local server, vehicle computer, camera processor or mobile device.
Edge processing can filter, aggregate, compress or classify data before transmission. It can also execute control loops locally. For example, an industrial gateway may detect an unsafe vibration pattern and stop a motor without waiting for a cloud response.
Edge does not necessarily mean that all processing occurs on the sensor. Rather, it means that processing is placed near the logical or physical source of data and near the user or actuator.
1.3 Fog computing
Fog computing is a hierarchical, distributed computing model that extends cloud capabilities through nodes located between end devices and the cloud. Fog nodes may include gateways, routers, access points, base stations, local servers and regional data centres. Unlike a single edge device, a fog layer can coordinate multiple edge devices and provide distributed services such as local orchestration, caching, stream analytics, service discovery and policy enforcement.
The distinction between edge and fog is not perfectly uniform across the literature. Edge emphasizes proximity to the endpoint; fog emphasizes a distributed intermediate layer and cooperation among nodes. In practical architectures, the terms may overlap.
Cloud edge fog IoT architecture
Figure: Cloud edge fog IoT architecture
Figure: A hierarchical IoT computing continuum from edge devices through fog nodes to the cloud.
2. Why Processing Location Matters
IoT data has several dimensions that influence placement:
Latency: the delay between sensing, computation and action.
Jitter: variation in delay, which can destabilize control systems.
Bandwidth: the communication capacity consumed by raw data.
Availability: the ability to operate during network or cloud outages.
Energy: computation and communication energy consumed by devices.
Privacy: exposure of personally identifiable, proprietary or sensitive data.
Scalability: ability to accommodate more devices and workloads.
Trust and compliance: requirements concerning location, auditability and control of data.
A cloud-only design may provide excellent scalability but poor disconnected operation. An edge-only design minimizes network dependence but may lack resources for complex analytics. A fog-cloud design can balance these properties.
2.1 Latency model
For a request that is processed remotely, end-to-end delay can be approximated by:
Here, Tsense is sensing and local preparation time, Tuplink and Tdownlink are communication delays, Tqueue is waiting time, Tcompute is processing time, and Tactuate is actuator response time. The model assumes a sequential path and excludes parallel execution. In a real system, some terms may overlap, and retransmissions may add further delay.
For a link transmitting a payload of size S bits at rate R bits per second, the serialization delay is:
ttx = S / R
Propagation, protocol, queuing and processing delays must be added to obtain actual network delay. A fog node may reduce Tuplink and Tdownlink, while an edge node may nearly eliminate wide-area communication delay.
2.2 Bandwidth reduction
Suppose a sensor produces r samples per second and each sample occupies b bits. The raw data rate is:
Draw = r × b
If local filtering retains a fraction α, where 0 ≤ α ≤ 1, the transmitted rate becomes:
Dfiltered = α × Draw
This simple model assumes a constant sample size and ignores protocol overhead. For example, 1,000 samples per second at 16 bits per sample generate 16,000 bit/s, or 2,000 bytes/s, before headers. If local inference transmits only 2% of the original stream, the payload rate becomes 320 bit/s.
2.3 Availability and reliability
If independent components must all operate for a service to function, series availability is:
Aseries = ∏(i=1 to n) Ai
where Ai is the availability of component i. Independence is a strong assumption and often unrealistic because power, network and cloud failures may be correlated. Local control can improve effective application availability by allowing safe operation when the wide-area network is unavailable.
3. Workload Placement and Architectural Models
Workload placement is the decision about where sensing, preprocessing, inference, storage, coordination and control should execute. A practical classification is:
Workload
Usually preferred location
Rationale
Emergency shutdown
Edge
Very low latency and offline operation
Sensor filtering
Edge or fog
Reduces bandwidth and noise
Coordination among a factory’s machines
Fog
Local shared context
Fleet-wide trend analysis
Cloud
Large-scale storage and computation
Machine-learning model training
Cloud or regional fog
High compute and data requirements
Model inference for a safety loop
Edge
Predictable local response
Device provisioning and audit
Cloud with local enforcement
Central policy and distributed execution
3.1 Centralized, hierarchical and federated models
A centralized architecture sends most data and computation to the cloud. It simplifies management but increases network dependence. A hierarchical architecture divides functions across edge, fog and cloud. A federated architecture allows several administrative domains or devices to train or improve models without sharing all raw data. Federated learning can reduce data movement, but model updates may still leak information and require secure aggregation, access control and poisoning defenses.
3.2 Service placement as an optimization problem
Let a set of services be indexed by j and candidate nodes by i. Define binary variable xij = 1 if service j is placed on node i, and 0 otherwise. A simplified objective is:
Minimize J = wT T + wE E + wC C + wR R
where T is latency, E is energy, C is monetary or resource cost, R is a risk measure, and the w values are non-negative stakeholder weights. The objective is meaningful only when the terms are normalized or expressed in compatible cost units. Typical constraints include:
∑i xij = 1
meaning each service is assigned to one node, together with capacity constraints such as:
∑j xij qj ≤ Qi
where qj is the resource demand of service j and Qi is the capacity of node i. Real deployments add placement affinity, privacy zones, resilience, mobility and migration constraints. The problem is often combinatorial; heuristic, integer-programming, reinforcement-learning or optimization-based approaches may be used depending on scale and time requirements.
4. Enabling Technologies
4.1 Virtual machines and containers
Virtual machines emulate complete computer environments and provide strong isolation, but they usually have greater memory and startup overhead. Containers share the host kernel and package application dependencies, making them attractive for fog and edge services. Containerization does not automatically guarantee security: kernel vulnerabilities, excessive privileges, insecure images and weak secrets management remain risks.
4.2 Orchestration
Orchestration manages deployment, scaling, health monitoring, configuration and recovery. Cloud-native orchestrators are powerful but may be too heavy for constrained nodes. Lightweight orchestrators and device-management protocols are often used at the edge. A sound design separates:
desired state, such as the required application version;
observed state, such as currently running instances; and
reconciliation, which corrects deviations between them.
4.3 Messaging and data handling
Publish–subscribe protocols such as MQTT are widely used because producers and consumers are decoupled. CoAP is designed for constrained devices and commonly uses a request–response model over UDP, with security provided through appropriate mechanisms. HTTP remains important for web integration and APIs.
Time-series databases store timestamped measurements, while stream processors support windows, joins, event detection and aggregation. Data should be classified according to sensitivity and retention requirements. Raw high-rate data may be retained briefly at the edge, summarized in the fog and stored selectively in the cloud.
4.4 Digital twins
A digital twin is a software representation of a physical asset or process, maintained using data, models and state transitions. Edge nodes provide current observations, fog nodes may maintain site-level context, and cloud systems can support fleet-wide simulation and optimization. A twin is useful only when its data provenance, update frequency, model assumptions and uncertainty are explicit.
5. Security, Privacy and Governance
Distributed computing enlarges the attack surface. Threats include device compromise, firmware tampering, rogue gateways, credential theft, insecure APIs, lateral movement, denial of service, model poisoning and data inference.
A defence-in-depth architecture should include:
hardware roots of trust and secure boot where feasible;
unique device identities and certificate-based authentication;
least-privilege authorization and network segmentation;
encrypted communication and protected data at rest;
signed, verified and rollback-capable software updates;
centralized logging with local detection and response;
vulnerability management and supply-chain assessment; and
tested incident-response and recovery procedures.
Privacy protection should begin with data minimization: collect and retain only what is necessary. Edge inference can keep raw audio, video or health data local while transmitting a decision or a statistically controlled summary. However, derived features may still identify individuals. Differential privacy, for example, introduces calibrated noise, but it creates a utility–privacy trade-off and is not a universal solution.
Governance questions include who owns sensor data, where it may be processed, who can alter an edge model, how long logs are retained and how decisions are audited. Safety-critical systems require explicit fail-safe behaviour; a loss of cloud connectivity must not silently produce unsafe actuation.
6. Energy and Sustainability
Communication can dominate the energy budget of battery-powered devices. A simplified energy model is:
Etotal = Esense + Ecompute + Etx + Erx
where the terms represent sensing, computation, transmission and reception energy. For a radio transmitting S bits with energy cost etx joules per bit:
Etx = S × etx
This model assumes a constant per-bit cost and omits startup, amplification, retransmission and idle energy. Local computation is beneficial when the energy saved by transmitting fewer bits exceeds the extra computation energy. Therefore, “edge is always greener” is not a valid general claim; placement must be measured over the full lifecycle, including cooling, embodied hardware energy and device replacement.
7. Worked Example: Selecting a Processing Location
An industrial camera generates 8 Mb/s of raw video. A local vision model requires 60 ms to classify a frame and sends only a 20 kb/s event stream. A cloud-based alternative requires 35 ms uplink delay, 25 ms cloud processing, 20 ms downlink delay and 10 ms actuation time. Assume local inference plus actuation takes 75 ms.
For the cloud path:
Tcloud = 35 ms + 25 ms + 20 ms + 10 ms = 90 ms
The local path is 75 ms, so it is faster by 15 ms under the stated assumptions. If the application requires a response below 80 ms, local inference satisfies the stated requirement while cloud inference does not.
The local classifier reduces the video payload from 8 Mb/s to 20 kb/s. The reduction factor is:
8,000 kb/s ÷ 20 kb/s = 400
Thus, the event stream is 1/400 of the raw rate, ignoring protocol overhead. Nevertheless, the cloud remains valuable for storing selected clips, retraining the model, comparing production lines and monitoring model drift. The appropriate answer is therefore hybrid placement rather than an absolute choice between edge and cloud.
8. Applied Case: Illustrative Smart Manufacturing System
Background
Consider a fictional electronics assembly plant containing robotic placement machines, optical inspection cameras, environmental sensors and a supervisory control system. The plant requires rapid fault response, production analytics and secure remote maintenance.
Problem
Raw camera streams are too large for continuous cloud transmission. Some defects must be detected within 100 ms. The plant also needs to operate safely during an Internet outage and must protect product designs and worker-related information.
Analysis
The emergency control loop has strict latency and availability requirements, so cloud-only processing is unsuitable. Cameras and machine controllers have sufficient local processing for filtering and inference. However, production-line coordination requires shared context across many machines, which is better provided by a fog server. Historical analysis and model training require cloud-scale storage and compute.
Approach and solution
Edge: cameras perform image preprocessing and defect inference; controllers execute interlocks and emergency stops.
Fog: an industrial server aggregates events, correlates defects with machine state, maintains a local dashboard and buffers data during network outages.
Cloud: selected images, summaries and maintenance records support fleet analytics, digital-twin simulation and model training.
Security: devices use individual certificates, signed firmware and segmented networks. The fog server enforces local authorization and records auditable events.
Operations: models are trained in the cloud, tested against a validation set, signed and deployed gradually to edge nodes. A rollback version remains available.
Outcome
The architecture reduces wide-area bandwidth, preserves local operation and provides a path to enterprise-scale analytics. Its success depends on accurate time synchronization, model monitoring, capacity planning and disciplined update management. A false positive may cause unnecessary downtime, while a false negative may allow defective products to escape; therefore, performance must be evaluated using production-relevant data rather than only laboratory accuracy.
Learning points
Placement should follow application constraints, not technology fashion.
Fog coordination is valuable when several edge devices share context.
Cloud analytics and edge control are complementary.
Safety, cybersecurity and update governance are architecture requirements.
AI inference creates operational, ethical and maintenance responsibilities.
9. Contemporary Developments and Research Directions
5G and private cellular networks can reduce wide-area latency and provide traffic prioritization, but performance depends on deployment, congestion and mobility. Multi-access edge computing (MEC) places services near mobile access networks and supports connected vehicles, augmented reality and industrial applications.
Serverless edge computing abstracts infrastructure and runs event-triggered functions, although cold starts, state management and intermittent connectivity remain challenges. Tiny machine learning (TinyML) places compact models on microcontrollers, enabling low-power local inference. Confidential computing uses hardware-supported protected execution, but trust assumptions and side-channel risks require careful evaluation.
Research challenges include robust orchestration across heterogeneous nodes, explainable and certifiable edge AI, federated learning under non-identically distributed data, adversarial resilience, semantic interoperability, sustainable lifecycle design and formal verification of distributed control. A significant methodological issue is reproducibility: results obtained in a laboratory with stable connectivity may not generalize to mobile, congested or failure-prone deployments.
10. Best-Practice Design Method
A professional design process can follow these steps:
Specify control deadlines, jitter limits, data rates, privacy constraints and failure behaviour.
Classify workloads as safety-critical, interactive, operational, analytical or archival.
Measure device CPU, memory, storage, energy and connectivity capabilities.
Place immediate control and privacy-sensitive preprocessing near the source.
Use fog resources for local coordination, caching and resilience.
Use cloud resources for global analytics, long-term storage and model training.
Define identity, authorization, encryption, update and logging mechanisms before deployment.
Test normal operation, overload, device loss, network partition, malicious input and recovery.
Monitor latency, jitter, bandwidth, energy, accuracy, drift, availability and cost.
Reassess placement as workloads, regulations, models and network conditions change.
Chapter Summary
Cloud, edge and fog computing form a distributed computing continuum for IoT. Cloud systems provide elastic global resources; edge systems provide proximity, low latency and local autonomy; fog systems coordinate multiple edge devices and offer an intermediate layer for local analytics, caching and resilience. Placement decisions should consider latency, jitter, bandwidth, energy, privacy, availability, cost, safety and scalability. Mathematical models for end-to-end delay, data reduction, availability and energy provide useful first-order analysis, but real deployments require measurement and validation. Containers, orchestration, messaging, digital twins and machine learning enable practical architectures. Security must include device identity, secure boot, least privilege, encryption, updates and monitoring. The strongest IoT designs are hybrid: urgent decisions remain local, regional context is handled in fog, and global learning and archival analysis use the cloud.
Key Terms
Cloud computing: On-demand, network-accessible computing resources delivered from centralized or distributed data centres.
Edge computing: Processing located close to the data source, user or actuator.
Fog computing: A distributed intermediate computing layer between edge devices and the cloud.
Computing continuum: The connected range of constrained devices, edge nodes, fog infrastructure and cloud resources.
Latency: Time taken for data and computation to produce a response.
Jitter: Variation in latency over time.
Workload placement: Assignment of application functions to particular computing locations.
Container: An isolated application environment sharing the host operating-system kernel.
Orchestration: Automated deployment, coordination, scaling and recovery of services.
MQTT: A lightweight publish–subscribe messaging protocol commonly used in IoT.
Digital twin: A software representation of a physical asset or process maintained using data and models.
Federated learning: Collaborative model training in which data generally remains at participating nodes.
Data minimization: Collection and retention of only the data necessary for a stated purpose.
Secure boot: A process that permits execution only of authenticated software.
Model drift: Degradation of model performance as operating conditions or data distributions change.
MEC: Multi-access edge computing, which places services near network access infrastructure.
TinyML: Machine learning executed on highly constrained embedded devices.
Availability: Probability or proportion of time that a service is operational.
Review Questions
Short Answer Questions
Define cloud, edge and fog computing and distinguish their principal locations.
Why can cloud-only processing be unsuitable for industrial control?
What is the purpose of a fog layer in a multi-device IoT deployment?
State two security controls required for edge nodes.
Explain data minimization in an IoT context.
Long Answer Questions
Compare cloud, edge and fog computing with respect to latency, bandwidth, scalability, resilience, energy and privacy.
Explain the role of containers and orchestration in distributed IoT systems.
Describe a secure hybrid architecture for a smart healthcare or manufacturing application.
Discuss the benefits and limitations of federated learning at the edge.
Explain why lifecycle sustainability cannot be assessed only by measuring network traffic.
Analytical / Application Questions
A sensor produces 500 samples per second, each containing 24 bits. A local filter transmits 5% of the samples. Calculate the raw and filtered payload rates, ignoring protocol overhead, and recommend a processing location.
Design a cloud–fog–edge architecture for a connected intersection. Assign at least four functions to layers and justify each assignment using latency, privacy and availability.
An edge AI model shows high laboratory accuracy but increasing field errors after six months. Analyse possible causes and propose a monitoring, retraining and deployment strategy.
Multiple Choice Questions with Answers
Question 1
Which characteristic most directly distinguishes edge computing from cloud computing?
A. Edge computing places processing closer to data sources or actuators.
B. Edge computing always uses more powerful processors than the cloud.
C. Edge computing eliminates the need for network security.
D. Edge computing stores all data permanently on sensors.
Correct Answer: A. Edge computing places processing closer to data sources or actuators.
Question 2
A sensor generates 1,000 samples per second and each sample contains 16 bits. What is the raw payload rate, ignoring protocol overhead?
A. 160 bit/s
B. 1,600 bit/s
C. 16,000 bit/s
D. 160,000 bit/s
Correct Answer: C. 16,000 bit/s
Question 3
Which workload is generally most appropriate for local edge execution?
A. Fleet-wide historical trend analysis
B. Emergency motor shutdown
C. Long-term archival storage
D. Training a very large global model
Correct Answer: B. Emergency motor shutdown
Question 4
In the latency model, which term represents waiting for an available processing or communication resource?
A. Actuation delay
B. Propagation delay
C. Queueing delay
D. Sensing delay
Correct Answer: C. Queueing delay
Question 5
What is a principal function of a fog layer?
A. Replacing every sensor with a cloud server
B. Coordinating and processing data from multiple nearby edge devices
C. Guaranteeing zero latency
D. Removing the need for device authentication
Correct Answer: B. Coordinating and processing data from multiple nearby edge devices
Question 6
A local filter retains a fraction α of raw data, where α = 0.02. What fraction of the original payload is transmitted?
A. 0.02%
B. 2%
C. 20%
D. 50%
Correct Answer: B. 2%
Question 7
Which control best supports software supply-chain integrity for edge devices?
A. Unsigned firmware updates
B. Shared administrator passwords
C. Signed and verified software updates
D. Disabling audit logs
Correct Answer: C. Signed and verified software updates
Question 8
Why may cloud processing remain valuable in a system that performs edge inference?
A. The cloud can support global analytics and model training.
B. The cloud always has lower latency than an edge node.
C. Edge inference cannot produce any useful result.
D. Cloud processing removes all privacy concerns.
Correct Answer: A. The cloud can support global analytics and model training.
Question 9
What is the main privacy rationale for processing sensitive raw video at the edge?
A. It guarantees that derived data cannot identify anyone.
B. It can reduce transmission of raw personally sensitive material.
C. It makes encryption unnecessary.
D. It prevents all model errors.
Correct Answer: B. It can reduce transmission of raw personally sensitive material.
Question 10
Which statement about energy efficiency is most accurate?
A. Sending data is always less energy-intensive than computing locally.
B. Local computing is always energy-neutral.
C. Placement should compare communication energy with computation and other lifecycle costs.
D. Cloud computing has no energy cost for IoT devices.
Correct Answer: C. Placement should compare communication energy with computation and other lifecycle costs.