Domain Name System (DNS)
DNS is the internet's phone book. It translates human-readable domain names (like sdprimer.com) into IP addresses that machines use to route traffic. Every time a user types a URL, a DNS lookup happens before a single byte of your application code runs.
DNS Record Types
| Record | Purpose | Example |
|---|---|---|
| A | Maps domain to IPv4 address | sdprimer.com → 93.184.216.34 |
| AAAA | Maps domain to IPv6 address | sdprimer.com → 2001:db8::1 |
| CNAME | Alias to another domain | www.sdprimer.com → sdprimer.com |
| MX | Mail server routing | sdprimer.com → mail.sdprimer.com |
| NS | Delegates to authoritative nameserver | sdprimer.com → ns1.provider.com |
| TXT | Arbitrary text (verification, SPF) | v=spf1 include:_spf.google.com |
DNS as a Load Distribution Tool
DNS isn't just name resolution — it's your first opportunity to distribute traffic. Managed DNS services like Route 53, Cloudflare DNS, or Google Cloud DNS offer:
- Weighted routing: Send 90% of traffic to your primary and 10% to a canary deployment.
- Latency-based routing: Direct users to the geographically closest data center.
- Failover routing: Automatically redirect traffic when health checks detect an outage.
- Geolocation routing: Route users based on their country or region (useful for compliance or localization).
Content Delivery Networks (CDN)
A CDN is a globally distributed network of edge servers that cache and serve content close to your users. Instead of every request traveling to your origin server (which might be in a single region), the CDN serves static assets — images, CSS, JavaScript, videos — from the nearest edge node.
Push CDN vs Pull CDN
You explicitly upload content to the CDN. You control exactly what gets cached and when it's updated.
- Best for: content that changes infrequently
- Pro: full control over cache contents
- Con: you manage upload + invalidation
CDN fetches content from your origin on the first request, then caches it. Subsequent requests are served from cache until TTL expires.
- Best for: high-traffic sites with diverse content
- Pro: zero config, lazy caching
- Con: first request is slow (cache miss)
Most modern CDNs (Cloudflare, Fastly, CloudFront) operate as pull CDNs by default, with the ability to push/preload specific assets when needed. This hybrid approach gives you the simplicity of pull with the control of push where it matters.
What CDNs Actually Improve
- Latency: Serving from a node 50ms away vs 200ms away is a massive UX difference, especially on mobile.
- Origin load: Your servers handle fewer requests. Most of your traffic is static assets that the CDN absorbs entirely.
- Availability: If your origin goes down briefly, cached content at the edge can still serve users.
- DDoS protection: CDN edge networks are designed to absorb large traffic spikes and malicious floods.