Edge Computing: Architecture Patterns and Trade-offs
#edge-computing#iot#cloud#architecture#cdn
Edge computing moves computation closer to the data source or end user. It is not a replacement for the cloud but a complement -- the right architecture places workloads where they deliver the most value based on latency, bandwidth, and data sovereignty requirements.
Edge Computing Tiers
| Tier | Location | Latency | Examples |
|---|---|---|---|
| Device edge | On the device itself | < 1ms | Smartphones, sensors, gateways |
| Near edge | Local network / on-premises | 1-10ms | Factory floor servers, retail stores |
| Far edge / MEC | Telco edge, regional PoP | 5-20ms | 5G MEC, ISP edge nodes |
| CDN edge | Distributed global PoPs | 10-50ms | Cloudflare, CloudFront, Fastly |
| Cloud region | Centralized data center | 50-200ms | AWS, GCP, Azure regions |
Architecture Patterns
CDN Edge Computing
Run code at CDN points of presence, closest to end users.
- Use cases: A/B testing, personalization, auth token validation, geo-routing
- Platforms: Cloudflare Workers, Lambda@Edge, Vercel Edge Functions, Deno Deploy
- Constraints: limited execution time, no persistent state, restricted APIs
IoT Edge
Process data on-premises or on gateway devices before sending to cloud.
- Use cases: manufacturing quality inspection, predictive maintenance, video analytics
- Platforms: AWS IoT Greengrass, Azure IoT Edge, Google Distributed Cloud Edge
- Constraints: limited compute, unreliable connectivity, device management complexity
Multi-Access Edge Computing (MEC)
Compute at the telecom network edge, enabled by 5G.
- Use cases: autonomous vehicles, AR/VR, real-time gaming, industrial automation
- Platforms: AWS Wavelength, Google Distributed Cloud, Azure Edge Zones
- Constraints: carrier partnerships required, limited geographic coverage
Edge vs Cloud Trade-offs
| Dimension | Edge | Cloud |
|---|---|---|
| Latency | Very low | Higher (network round trip) |
| Bandwidth cost | Reduced (process locally) | Higher (transfer all data) |
| Compute capacity | Limited | Virtually unlimited |
| Data freshness | Real-time | Near-real-time to batch |
| Management complexity | High (many distributed nodes) | Lower (centralized) |
| Cost model | Hardware + maintenance | Pay-per-use |
| Security perimeter | Physically distributed | Centralized controls |
| Update deployment | Complex (fleet management) | Simple (centralized) |
Edge AI/ML Inference
Running ML models at the edge enables real-time decisions without cloud round trips:
- Model optimization -- TensorFlow Lite, ONNX Runtime, TensorRT for constrained devices
- Hardware acceleration -- NVIDIA Jetson, Google Coral, Intel Neural Compute Stick
- Model management -- versioning, A/B testing, and rollback across thousands of devices
- Federated learning -- train on edge data without sending it to the cloud
When to Infer at the Edge
| Factor | Edge Inference | Cloud Inference |
|---|---|---|
| Latency requirement | < 100ms | Seconds acceptable |
| Data sensitivity | Cannot leave premises | Can be sent to cloud |
| Connectivity | Intermittent or absent | Reliable |
| Model complexity | Simple to medium | Complex, large models |
| Update frequency | Infrequent | Frequent iteration |
Data Synchronization Challenges
Edge architectures must handle data that exists in multiple locations:
- Conflict resolution -- what happens when edge and cloud disagree? Last-write-wins, CRDTs, or manual resolution
- Eventual consistency -- edge nodes may be offline; design for eventual sync
- Data filtering -- send only aggregated or anomalous data to cloud, not raw streams
- Bandwidth management -- prioritize critical data when connectivity is limited
- State management -- where is the source of truth? Cloud, edge, or both?
CDN Edge Platforms Comparison
| Platform | Runtime | Execution Limit | Global PoPs | Persistent Storage |
|---|---|---|---|---|
| Cloudflare Workers | V8 isolates | 30s (paid) | 300+ | KV, R2, D1, Durable Objects |
| Lambda@Edge | Node.js, Python | 30s (viewer), 30s (origin) | CloudFront PoPs | Limited (via S3/DynamoDB) |
| Vercel Edge Functions | V8 isolates | 30s | Vercel network | Via external stores |
| Fly.io | Full containers | No limit | 30+ regions | Volumes, LiteFS |
| Deno Deploy | V8 isolates | 50ms CPU | 35+ regions | Deno KV |