Edge vs. Origin: The Request Flow
What you'll learn: How CDNs decide whether to serve content from edge locations or fetch it from origin servers, and why that choice matters for different workloads.
The Two-Tier System
When a user requests content through a CDN, the system must decide: serve from the edge or fetch from origin?
Edge locations are distributed servers close to users. They cache static content and can execute lightweight compute tasks. Think of them as convenience stores in your neighborhood—quick access to common items.
Origin servers are your centralized data centers where the authoritative version of content lives and complex processing happens. These are like warehouses—they have everything, but they're farther away.
The Request Flow Decision
-
User makes request → routed to nearest edge location
-
Edge checks its cache:
- Cache HIT: Content exists and is fresh → serve immediately (fastest)
- Cache MISS: Content not cached or expired → forward to origin
-
Origin processes request (if needed):
- Generates dynamic content or retrieves fresh static files
- Sends response back through edge
- Edge caches it (if cacheable) for future requests
When to Use Each
Edge-appropriate workloads:
- Static assets (images, CSS, JavaScript)
- Cached API responses with predictable TTLs
- Edge functions (authentication, redirects, A/B testing)
- Low-latency requirements
Origin-appropriate workloads:
- User-specific dynamic content
- Real-time personalization
- Database queries and transactions
- Content requiring complex business logic
Key Takeaway: Edge locations optimize for speed by serving cached content close to users, while origin servers handle authoritative data and complex processing—the CDN intelligently routes requests between them based on cache status and content type.