When Should You Use Edge Compute vs Centralized Services and What Are the Cost and Complexity Trade Offs?
Centralized Architecture Characteristics
Centralized architectures run all application logic in one or few data center locations. Requests traverse the full network path regardless of user location. A user in Sydney accessing a US-based service experiences 150-200ms round-trip latency before any processing begins. Centralized systems excel at stateful operations: database transactions, session management, complex business logic requiring consistent state. They simplify debugging (single deployment), reduce infrastructure complexity, and allow unlimited compute resources at the processing tier.
Edge Compute Characteristics
Edge compute distributes processing to CDN nodes worldwide, executing code within 10-50ms of users. Edge functions run in constrained environments: 128MB memory limits, 50ms CPU time caps, no persistent storage. They excel at stateless transformations: request routing, authentication token validation, A/B test assignment, response personalization, bot detection. Edge functions cannot maintain sessions or access centralized databases without latency penalties that negate their proximity advantage.
Hybrid Architecture Patterns
Production systems layer edge and centralized compute. Edge gateway pattern: edge handles authentication (validating JWTs, which are JSON Web Tokens containing cryptographically signed user claims), rate limiting, and request routing; valid requests proceed to centralized services. Edge rendering pattern: edge assembles personalized pages from cached fragments and centralized API responses. Edge failover pattern: if origin is unreachable (500ms timeout), edge serves stale cached content with degraded functionality rather than errors. Each pattern reduces origin load while maintaining consistent business logic centrally.
Decision Framework
Use edge when: Operation is stateless, latency-sensitive, and can complete within resource limits. Examples: CDN routing, auth validation, feature flags, personalization from cached user profiles. Use centralized when: Operation requires database access, complex state, or unlimited compute. Examples: payment processing, order management, analytics aggregation. Key metric: If 90% of requests can be handled at edge, you reduce origin traffic by 90% while improving p95 latency (the 95th percentile response time, meaning 95% of requests complete faster than this value) from 300ms to 50ms.