ESC
Type to search guides, tutorials, and reference documentation.
Verified by Garnet Grid

Edge Computing Architecture

Design systems that push computation to the network edge for lower latency, reduced bandwidth, and real-time processing. Covers edge vs cloud trade-offs, CDN workers, IoT edge, edge databases, and the patterns that make edge computing practical.

Edge computing moves computation closer to users and data sources. Instead of sending every request to a centralized data center, edge nodes process data at the point of creation or consumption. The result: lower latency (< 50ms globally), reduced bandwidth costs, and the ability to process real-time data streams.


Where is “The Edge”?

Far Edge:      On-device (smartphone, IoT sensor, vehicle)
Near Edge:     Local server (factory floor, retail store, cell tower)
Network Edge:  CDN PoPs, cloud edge locations (100+ locations)
Cloud Edge:    Regional data centers (10-30 locations)
Cloud Core:    Centralized data centers (3-5 regions)

Edge Computing Patterns

CDN Workers

Execute code at CDN edge locations (200+ PoPs globally):

// Cloudflare Worker: A/B testing at the edge
export default {
  async fetch(request) {
    const url = new URL(request.url);
    
    // Determine variant (no round-trip to origin)
    const cookie = request.headers.get('cookie') || '';
    let variant = cookie.match(/ab_test=(\w+)/)?.[1];
    
    if (!variant) {
      variant = Math.random() < 0.5 ? 'control' : 'experiment';
    }
    
    // Rewrite URL to correct variant
    url.pathname = `/${variant}${url.pathname}`;
    
    const response = await fetch(url.toString(), request);
    const modifiedResponse = new Response(response.body, response);
    modifiedResponse.headers.set('Set-Cookie', `ab_test=${variant}; path=/;`);
    
    return modifiedResponse;
  }
};

Edge API

// Edge function: Geo-aware API responses  
export default {
  async fetch(request, env) {
    const country = request.cf?.country || 'US';
    const city = request.cf?.city || 'Unknown';
    
    // Serve from edge KV store (no origin round-trip)
    const localData = await env.KV.get(`products:${country}`, 'json');
    
    if (localData) {
      return new Response(JSON.stringify(localData), {
        headers: { 'Content-Type': 'application/json' }
      });
    }
    
    // Fall back to origin
    return fetch(`https://api.origin.com/products?country=${country}`);
  }
};

Edge Databases

DatabaseTypeReplicationUse Case
Cloudflare D1SQLite at edgeAutomatic to 200+ PoPsSimple queries, read-heavy
Turso (libSQL)Distributed SQLiteMulti-region replicasLow-latency reads globally
PlanetScaleMySQL-compatibleGlobal read replicasVitess-based, MySQL workloads
NeonPostgreSQLRead replicas at edgeServerless Postgres
DynamoDB Global TablesNoSQLMulti-region active-activeAWS-native, key-value

Edge vs Cloud Decision

Process at the edge when:
  ✅ Latency-sensitive (< 50ms requirement)
  ✅ High-bandwidth source data (filter before sending to cloud)
  ✅ Privacy-sensitive (process locally, send aggregates)
  ✅ Real-time decisions (autonomous vehicles, industrial control)
  ✅ Offline-capable (intermittent connectivity)

Process in the cloud when:
  ✅ Complex computation (ML training, analytics)
  ✅ Cross-region data aggregation
  ✅ Stateful transactions requiring strong consistency
  ✅ Large-scale storage and processing

IoT Edge

IoT Devices (1000s)
  ↓ (sensor data: temperature, pressure, vibration)
Edge Gateway (1 per facility)
  ├── Filter: Discard noise, keep anomalies
  ├── Aggregate: 1-second readings → 1-minute summaries
  ├── Alert: Local notification for critical values
  └── Forward: Send summaries to cloud (90% bandwidth reduction)

Cloud Platform
  ├── Store historical data
  ├── Train ML models
  ├── Dashboard and analytics
  └── Push updated models to edge

Anti-Patterns

Anti-PatternConsequenceFix
Edge for compute-heavy workloadsEdge nodes under-poweredKeep heavy compute in cloud
Strong consistency at the edgeHigh latency, defeats purposeEventual consistency for edge data
No fallback to cloudEdge failure = total failureGraceful fallback to origin
Treating edge like cloud (stateful)Data loss, sync complexityStateless edge, state in cloud/edge DB
No observability at edgeBlind spots in 200+ locationsEdge-native logging and metrics

Edge computing is not a replacement for cloud — it is an extension. The best architectures use edge for latency-sensitive, bandwidth-intensive tasks and cloud for compute-intensive, stateful, and analytical workloads.

Jakub Dimitri Rezayev
Jakub Dimitri Rezayev
Founder & Chief Architect • Garnet Grid Consulting

Jakub holds an M.S. in Customer Intelligence & Analytics and a B.S. in Finance & Computer Science from Pace University. With deep expertise spanning D365 F&O, Azure, Power BI, and AI/ML systems, he architects enterprise solutions that bridge legacy systems and modern technology — and has led multi-million dollar ERP implementations for Fortune 500 supply chains.

View Full Profile →