CDN & Networking Notes
High-level concepts for content delivery, HTTP, routing, and reliability.
Quick Navigation
CDN Fundamentals
Core Ideas
- CDN (Content Delivery Network): A globally distributed network of servers that cache and deliver content closer to users. What it does: Reduces latency and offloads origin traffic. Use case: Faster image/CSS/JS delivery worldwide.
- Edge location (POP = Point of Presence): A regional CDN site with cache servers. What it does: Serves cached content locally. Use case: A user in Chicago is served from a nearby POP instead of your origin.
- Origin server: The source server where content is hosted. What it does: Provides the canonical response when cache misses occur. Use case: Your web app or API behind the CDN.
- Cache hit / Cache miss: Hit = served from edge cache; Miss = fetched from origin. What it does: Determines speed and origin load. Use case: High hit ratio keeps traffic off origin.
- TTL (Time To Live): How long cached content is considered fresh. What it does: Controls cache lifespan. Use case: Set short TTL for frequently updated pages, long TTL for static assets.
- Purge / Invalidation: Force cached content to be removed early. What it does: Ensures users see new content immediately. Use case: After deploying new JS/CSS.
- Cache bypass: Rules that skip caching. What it does: Ensures dynamic or personalized pages are always fresh. Use case: Authenticated dashboards.
Edge Compute (High Level)
- Edge compute: Running lightweight logic at the edge. What it does: Modifies requests/responses before they hit origin. Use case: Geo‑based redirects or auth header injection.
- Header manipulation: Add/strip headers at the edge. What it does: Enforces caching and security rules. Use case: Set Cache-Control for static assets.
- Routing rules: Decide which origin to use. What it does: Sends traffic to the right backend. Use case: Blue/green deployments.
HTTP & Web Delivery
Protocol Basics
- HTTP (Hypertext Transfer Protocol): The request/response protocol for web traffic. What it does: Defines how clients and servers exchange data. Use case: Loading a webpage or API response.
- HTTPS (HTTP Secure): HTTP over TLS encryption. What it does: Protects data in transit. Use case: Login pages and any private data transfer.
- TLS (Transport Layer Security): The encryption protocol used by HTTPS. What it does: Encrypts and authenticates connections. Use case: Prevent MITM attacks.
- Headers: Metadata sent with requests/responses. What it does: Controls caching, auth, and behavior. Use case: Cache-Control, Authorization, User-Agent.
Status & Caching
- Status codes: 2xx success, 3xx redirect, 4xx client error, 5xx server error. What it does: Tells you the outcome of a request. Use case: Debug cache or origin errors.
- Cache-Control: Cache policy header. What it does: Sets how long content can be cached. Use case: max-age=3600 for static assets.
- ETag (Entity Tag): Resource version identifier. What it does: Lets clients revalidate efficiently. Use case: 304 responses for unchanged content.
- 304 Not Modified: Reuse cached content without redownloading. What it does: Saves bandwidth. Use case: Browser checks if asset changed.
Performance Terms
- Latency: Time for a request to travel to the server and back. What it does: Affects how fast pages start loading. Use case: CDN reduces latency by serving closer.
- Bandwidth: Maximum data capacity of a connection. What it does: Limits how fast large files download. Use case: Video delivery and large assets.
- Throughput: Actual delivered data rate. What it does: Real-world speed after overhead. Use case: Compare CDN performance across regions.
Networking Core Concepts
Foundations
- IP (Internet Protocol, IPv4/IPv6): A unique address for a device. What it does: Identifies where traffic should go. Use case: DNS returns IPs for domains.
- DNS (Domain Name System): Maps domain names to IPs. What it does: Lets users type names instead of numbers. Use case: example.com → 93.184.216.34.
- DNS propagation: Time for DNS updates to spread globally. What it does: Delays changes being seen. Use case: New CDN CNAME may take hours to fully apply.
- Anycast: One IP announced from many locations. What it does: Routes users to the nearest/healthiest POP. Use case: Global CDN edge IPs.
- BGP (Border Gateway Protocol): The internet routing protocol between networks. What it does: Chooses paths between ASNs. Use case: CDN traffic steering.
- ASN (Autonomous System Number): ID for a network on the internet. What it does: Identifies routing domains in BGP. Use case: ISPs and CDNs have ASNs.
Traffic Flow
- Peering: Direct exchange of traffic between networks. What it does: Lowers latency and cost. Use case: CDN peering with large ISPs.
- Transit: Paid connectivity to the wider internet. What it does: Provides global reach. Use case: Small networks buying upstream access.
- Load balancing: Distributes traffic across servers. What it does: Prevents overload. Use case: Multiple origins behind a CDN.
- Reverse proxy: Sits in front of origin and forwards requests. What it does: Shields origin and enables caching. Use case: CDN edge acting as reverse proxy.
Reliability & Monitoring
Operational Basics
- Uptime: Percent of time the service is running. What it does: Measures availability. Use case: 99.99% target for critical services.
- SLA (Service Level Agreement): Availability/performance guarantee. What it does: Sets expectations and penalties. Use case: Enterprise contracts.
- Incident: Disruption of normal service. What it does: Triggers response process. Use case: Outage, elevated error rates.
- Alerting: Automated notifications for issues. What it does: Flags problems fast. Use case: Latency spike alert.
- Observability: Understanding system health via signals. What it does: Helps debug and prevent outages. Use case: Logs + metrics + traces.
- MTTR (Mean Time To Recover): Average time to restore service. What it does: Measures recovery speed. Use case: Track incident response performance.
Signals & Protection
- Logs: Time‑ordered events. What it does: Explains what happened. Use case: Debug 5xx spikes.
- Metrics: Numeric time‑series data. What it does: Shows trends. Use case: Latency and error rate dashboards.
- Traces: End‑to‑end request timing. What it does: Pinpoints slow services. Use case: Microservice bottlenecks.
- Rate limiting: Controls request volume. What it does: Prevents abuse. Use case: API protection.
- DDoS (Distributed Denial of Service): Flood attack. What it does: Overwhelms services. Use case: Needs CDN/edge mitigation.
- WAF (Web Application Firewall): Filters HTTP attacks. What it does: Blocks malicious patterns. Use case: SQLi/XSS protection.
- Health checks: Periodic probes of upstreams. What it does: Avoids routing to unhealthy servers. Use case: Failover decisions.
Edge & Config Concepts
Advanced Delivery Concepts
- Edge configuration: Rules that control routing and caching. What it does: Shapes traffic behavior. Use case: Cache static assets but bypass auth pages.
- Edge dictionaries: Key‑value config at the edge. What it does: Enables fast changes without deploys. Use case: Feature flags or allowlists.
- Shielding: Designated “parent” cache. What it does: Reduces origin load by consolidating misses. Use case: Large traffic spikes.
- Streaming logs: Real‑time log delivery. What it does: Faster debugging. Use case: Live incident monitoring.
- Origin protection: Keep origin off the public internet. What it does: Reduces attack surface. Use case: Allow only CDN IPs to reach origin.
