From Cloud to Fog: Computing Moves Closer
How moving workloads nearer to data slashes latency, trims costs, and unlocks new real-time apps — without abandoning the cloud you already…
From Cloud to Fog: Computing Moves Closer
How moving workloads nearer to data slashes latency, trims costs, and unlocks new real-time apps — without abandoning the cloud you already have.

Fog computing brings compute and storage closer to data sources to cut latency, bandwidth, and cost. Learn when it beats cloud, where it fits, and how to ship it in 2025.
You’ve probably felt it: the cloud is great — until physics shows up. Cameras stream too much. Sensors chatter nonstop. Users expect instant answers. And networks, being networks, hiccup at the worst time. That’s where fog computing steps in: keep the cloud, but push the work that hates distance closer to where data is born.
Fog vs. Edge vs. Cloud (plain English)
- Cloud: centralized compute and storage; elastic, global, and fantastic for heavy batch jobs and long-term data.
- Edge: compute on or inside the device (a camera, phone, PLC).
- Fog: a nearby layer between device and cloud — micro-data centers in stores, factories, base stations, or on-prem racks. Think “metro stop” between the device and the cloud.
When fog wins: you need sub-50 ms decisions, backhaul is pricey, data is sensitive, or connectivity is flaky. When cloud wins: model training, global coordination, cold storage, and anything that thrives on massive scale.
Why everyone’s leaning fog in 2025
- Latency is a product feature. A 150 ms round trip breaks cashierless checkout, machine vision gates, and haptics. Fog cuts the path.
- Data gravity is real. 4K streams and high-rate sensor firehoses are too costly to haul unfiltered.
- Privacy & locality. Keep raw data inside the site; export only aggregates or embeddings.
- Resilience. Sites keep working during provider or backhaul blips — then sync later.
Let’s be real: this isn’t anti-cloud. It’s cloud made practical for the physical world.
Where fog computing already shines
Retail & venues
Computer vision for queue length, planogram checks, and shrink detection. Fog does frame selection, detection, and eventing; the cloud handles retraining and fleet analytics.
Manufacturing & robotics
Closed-loop control can’t tolerate WAN jitter. Fog nodes coordinate robots, run ML for quality inspection, and stream only exceptions upstream.
Telco & city infrastructure
Roadside units and base stations host low-latency services: V2X alerts, adaptive signage, and emergency prioritization — fog handles the timing budget.
Healthcare and labs
Local inference on medical images or biosignals preserves privacy and continuity, while the cloud aggregates learnings across institutions.
What stays in the cloud
- Model training & A/Bs on big, shared datasets.
- Global state & billing and customer-facing APIs.
- Data lake/warehouse for compliance, lineage, and long-tail queries.
Fog complements; it doesn’t replace.
Patterns that work (and scale)
1) Filter → Enrich → Decide → Summarize
At the site, drop obvious noise, add local context (zone, device health), make the decision, and send events — not raw firehoses — upstream.
2) “Small brain, big brain”
Run a compact on-device or fog model for the hot path; periodically distill improvements from cloud-trained models back to the fleet.
3) Event mesh over brittle point-to-point
Use a local message bus (MQTT/NATS/Kafka) for producers/consumers. It tolerates partial failure and smooths bursts.
4) Immutable rollout, fast rollback
Treat fog nodes like mini production clusters: image-based deploys, versioned configs, and one-click revert.
A tiny, practical example
Local inference on a Jetson/NUC, emitting only summarized events to MQTT:
# edge_infer.py
import json, time, onnxruntime as ort
import numpy as np
import paho.mqtt.client as mqtt
sess = ort.InferenceSession("detector.onnx", providers=["CUDAExecutionProvider","CPUExecutionProvider"])
mqttc = mqtt.Client(client_id="site-A-fog-01"); mqttc.connect("localhost", 1883)
def preprocess(frame):
# resize/normalize → NxCxHxW float32
x = frame.astype("float32") / 255.0
x = np.transpose(x, (2,0,1))[None, ...]
return x
def publish(event):
mqttc.publish("events/detections", json.dumps(event), qos=1, retain=False)
while True:
frame = grab_frame() # local camera
x = preprocess(frame)
scores, boxes = sess.run(None, {"images": x})
keep = nms(boxes[0], scores[0], thr=0.5)
for cls, conf, box in keep:
publish({"ts": time.time(), "cls": int(cls), "conf": float(conf), "box": [float(v) for v in box]})
Why this helps: the WAN never sees video; it only sees a trickle of meaningful detections. Costs go down, privacy goes up, latency is local.
Tooling that doesn’t fight you
- Lightweight orchestration: K3s or MicroK8s for site clusters; Nomad for simpler fleets; WebAssembly runtimes for tiny footprints.
- Messaging: MQTT for constrained devices, NATS for low-latency pub/sub, Kafka for durable streams.
- Models: ONNX Runtime/TensorRT for inference; periodically update from the cloud with signed artifacts.
- Data: Parquet/Arrow locally for cold minutes/hours; batch-sync to a lake when links are cheap.
- Observability: ship summaries and exemplars; keep raw spans local. Use OpenTelemetry everywhere.
- Security: mutual TLS, device identity, short-lived tokens, and measured boot where hardware allows.
What to measure (so you don’t fly blind)
- End-to-end latency (sensor → decision → act).
- Backhaul reduction (GB saved vs. raw).
- Uptime during WAN loss (minutes of autonomous operation).
- Model freshness lag (time from cloud-train to site-deploy).
- Energy budget per site (especially off-grid or battery-backed).
Risks and the boring cures
- Fleet drift: bake everything into images; immutable root; config pulled, not pushed.
- Shadow APIs: require all egress through the mesh with allow-lists.
- “Science fair” sprawl: standardize a handful of patterns; resist snowflakes.
- Model rot: schedule staged rollouts with canaries and automatic fallbacks to the previous version.
- Compliance surprises: keep PII at the site; export aggregates or hashed IDs; audit routes.
A 30–60–90 roadmap that teams actually run
Days 1–30 — Pick one narrow loop
- Choose a high-value, low-scope use case (e.g., “count people per entrance”).
- Stand up a single fog node with a message bus, local store, and metrics.
- Agree on the contract: events, schema, and SLO for latency.
Days 31–60 — Make it boring
- Add immutable deploys, signed artifacts, and one-command rollback.
- Wire OpenTelemetry; alert on symptoms (decision latency), not box health.
- Prove backhaul reduction and autonomous operation during WAN loss.
Days 61–90 — Scale without heroics
- Add fleet management: OTA updates, staged rollouts, and inventory.
- Introduce a second use case; reuse 80% of the platform.
- Start the “small brain, big brain” loop: cloud retrains → signed model → staged fog deploy.
Anti-patterns to avoid
- Shipping raw video/sensor data to cloud by default — your network team will find you.
- DIY crypto. Use proven libs, rotate aggressively, and assume nodes are lootable.
- Per-site scripting. Treat sites as cattle, not pets.
- Over-centralized control planes that brick sites when the WAN sneezes.
The bigger picture
Fog isn’t a rebellion. It’s the web’s physicalization — putting compute where time, money, and privacy demand it. Cloud remains the brain trust and the archive. Fog becomes the reflex.
If you want a hands-on follow-up — a reproducible fog starter with K3s, MQTT, ONNX Runtime, and an observability pack — drop a comment. And if this clarified your roadmap, follow along; I’ll share a minimal reference stack next.
메타데이터
- post_id
- a0bb531e616b
- slug
- from-cloud-to-fog-computing-moves-closer-a0bb531e616b
- url
- https://medium.com/@sparknp1/from-cloud-to-fog-computing-moves-closer-a0bb531e616b
- canonical_url
- https://medium.com/@sparknp1/from-cloud-to-fog-computing-moves-closer-a0bb531e616b
- author_url
- https://medium.com/@sparknp1
- status
- ok
- fetched_at
- 2026-08-12 07:29:34