What is a CDN and how does it work with hosting to improve performance?
A CDN (Content Delivery Network) is a globally distributed network of edge servers that caches copies of your website's static assets (images, CSS, JS, videos) close to your visitors, serving them from the nearest location instead of always fetching from your origin server.
DETAILED EXPLANATION:
Without CDN: A visitor in London requesting images from a server in Mumbai waits for: DNS lookup + TCP handshake + SSL negotiation + round-trip to Mumbai (~200ms just for network latency). With CDN: Same request hits Cloudflare's London PoP — cache hit serves in <10ms.
CDN architecture:
- Origin server: Your actual web server (Connect Quest VPS/Hosting)
- Edge nodes/PoPs: Cloudflare/AWS CloudFront/Bunny CDN servers worldwide
- Cache: Edge stores copies of static assets per URL
- TTL: How long edge keeps cache before checking origin for updates
Types of CDN caching:
- Pull CDN: Edge fetches from origin on first miss, then caches (Cloudflare)
- Push CDN: You upload assets to CDN (AWS S3 + CloudFront, Bunny Storage)
WHEN TO USE:
- Any website with global or national visitors
- Image-heavy sites (portfolios, ecommerce)
- Video hosting or streaming
- Sites experiencing slow load times from distant visitors
STEP-BY-STEP — Set up Bunny CDN with Connect Quest Hosting:
1. Sign up at bunny.net
2. Add pull zone: origin URL = https://yourdomain.com
3. Add CDN hostname: Get CDN URL (e.g., yoursite.b-cdn.net)
4. In WordPress: Install CDN Enabler plugin
5. Set CDN URL: yoursite.b-cdn.net
6. Clear cache → test: images now load from CDN
7. Custom domain: CNAME cdn.yourdomain.com → yoursite.b-cdn.net
8. Enable: HTTP/2, Brotli, Perma-Cache (object storage)
REAL EXAMPLES:
# Test CDN response vs origin
# Origin response time
curl -w "Time: %{time_total}s" -o /dev/null -s https://origin.yourdomain.com/image.jpg
# Time: 0.847s
# CDN response time (from nearest PoP)
curl -w "Time: %{time_total}s" -o /dev/null -s https://cdn.yourdomain.com/image.jpg
# Time: 0.043s
# Check CDN cache status header
curl -I https://cdn.yourdomain.com/image.jpg | grep -i "cf-cache-status"
# cf-cache-status: HIT
FLOW:
First request: [ User in Delhi ] → CDN Delhi PoP (MISS) → [ Mumbai Origin ] → CDN caches → [ User ]
Subsequent: [ User in Delhi ] → CDN Delhi PoP (HIT: 15ms) → [ User ]
KEY POINTS:
- Cloudflare CDN is free; Bunny CDN is ₹0.5-1/GB egress (cheaper than AWS CloudFront)
- Cache bust after deployment: purge CDN or use version query strings (?v=2024)
- Dynamic content (shopping cart, logged-in state) should bypass CDN
- Connect Quest hosting works seamlessly with any CDN provider
COMMON MISTAKES:
- Caching HTML pages with personalized content (shows wrong user's cart)
- Not purging CDN after site updates (visitors see old version)
- Setting too long TTL for frequently changed assets
QUICK FIX:
Old version showing after update → CDN purge: Cloudflare Dashboard > Caching > Purge Cache > Purge Everything
DIFFICULTY: Beginner
RELATED: Website Performance, DDoS Protection, Cloudflare, Hosting Speed
DETAILED EXPLANATION:
Without CDN: A visitor in London requesting images from a server in Mumbai waits for: DNS lookup + TCP handshake + SSL negotiation + round-trip to Mumbai (~200ms just for network latency). With CDN: Same request hits Cloudflare's London PoP — cache hit serves in <10ms.
CDN architecture:
- Origin server: Your actual web server (Connect Quest VPS/Hosting)
- Edge nodes/PoPs: Cloudflare/AWS CloudFront/Bunny CDN servers worldwide
- Cache: Edge stores copies of static assets per URL
- TTL: How long edge keeps cache before checking origin for updates
Types of CDN caching:
- Pull CDN: Edge fetches from origin on first miss, then caches (Cloudflare)
- Push CDN: You upload assets to CDN (AWS S3 + CloudFront, Bunny Storage)
WHEN TO USE:
- Any website with global or national visitors
- Image-heavy sites (portfolios, ecommerce)
- Video hosting or streaming
- Sites experiencing slow load times from distant visitors
STEP-BY-STEP — Set up Bunny CDN with Connect Quest Hosting:
1. Sign up at bunny.net
2. Add pull zone: origin URL = https://yourdomain.com
3. Add CDN hostname: Get CDN URL (e.g., yoursite.b-cdn.net)
4. In WordPress: Install CDN Enabler plugin
5. Set CDN URL: yoursite.b-cdn.net
6. Clear cache → test: images now load from CDN
7. Custom domain: CNAME cdn.yourdomain.com → yoursite.b-cdn.net
8. Enable: HTTP/2, Brotli, Perma-Cache (object storage)
REAL EXAMPLES:
# Test CDN response vs origin
# Origin response time
curl -w "Time: %{time_total}s" -o /dev/null -s https://origin.yourdomain.com/image.jpg
# Time: 0.847s
# CDN response time (from nearest PoP)
curl -w "Time: %{time_total}s" -o /dev/null -s https://cdn.yourdomain.com/image.jpg
# Time: 0.043s
# Check CDN cache status header
curl -I https://cdn.yourdomain.com/image.jpg | grep -i "cf-cache-status"
# cf-cache-status: HIT
FLOW:
First request: [ User in Delhi ] → CDN Delhi PoP (MISS) → [ Mumbai Origin ] → CDN caches → [ User ]
Subsequent: [ User in Delhi ] → CDN Delhi PoP (HIT: 15ms) → [ User ]
KEY POINTS:
- Cloudflare CDN is free; Bunny CDN is ₹0.5-1/GB egress (cheaper than AWS CloudFront)
- Cache bust after deployment: purge CDN or use version query strings (?v=2024)
- Dynamic content (shopping cart, logged-in state) should bypass CDN
- Connect Quest hosting works seamlessly with any CDN provider
COMMON MISTAKES:
- Caching HTML pages with personalized content (shows wrong user's cart)
- Not purging CDN after site updates (visitors see old version)
- Setting too long TTL for frequently changed assets
QUICK FIX:
Old version showing after update → CDN purge: Cloudflare Dashboard > Caching > Purge Cache > Purge Everything
DIFFICULTY: Beginner
RELATED: Website Performance, DDoS Protection, Cloudflare, Hosting Speed