Networking & ProtocolsCDN Architecture & Edge ComputingHard⏱️ ~3 min

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.

Key Insight: Edge compute is not a replacement for centralized architecture but a complementary layer. The best systems use edge for the fast path (stateless, cacheable operations) and centralized for the complete path (stateful, transactional operations), routing each request to the appropriate tier.
💡 Key Takeaways
Centralized: 150-200ms network latency, unlimited compute, stateful operations, simpler debugging
Edge: 10-50ms latency, 128MB memory and 50ms CPU limits, stateless transformations only
Hybrid patterns: edge gateway for auth/routing, edge rendering for personalization, edge failover for resilience
Edge can reduce origin traffic 90% while improving p95 latency from 300ms to 50ms
📌 Interview Tips
1Explain edge compute constraints: 128MB memory, 50ms CPU time, no persistent storage
2Describe edge gateway pattern: validate JWTs at edge, only route valid requests to origin
3Mention that edge is complementary layer not replacement: fast path at edge, complete path centralized
← Back to CDN Architecture & Edge Computing Overview