CDN vs. Web Hosting
A content delivery network, a.k.a. content distribution network, is simply a widely distributed network of servers, often in multiple countries across the globe. A CDN helps deliver content faster and make the user experience uniform regardless of the user’s location. The bigger the coverage of the CDN, the faster it can serve your content to those users located far from your web host’s data center.
Given their similarities, CDN might be confused with web hosting. Just remember, CDNs do not replace web hosting, but rather complement it. A web host provides the server where you’d upload your website files, whereas a CDN is a wide server network that speeds up the delivery of your website content to your users. Some web hosting providers, in fact, bundle CDN services into their hosting plans. A SiteGround subscription, for example, comes with free (basic) Cloudflare protection.
Video: Content Delivery Network (CDN) Basics by CDNetworks
How Do CDNs Work?
Much of the internet’s workings is invisible to people, and it’s been designed that way. This makes it easy to forget that the internet has a physical aspect, and that the data we ask for and get almost instantly at the touch of a button or a mouse click has to travel through the global infrastructure of interconnected wires, cables, and satellites linking millions of computers and network devices.
Data packets—tiny, broken-down components of a web page, email, or other information routed separately all over the internet—can travel at (nearly) the speed of light due to fiber optic cables. However, the user’s distance from the host server can affect how long the requested data packets travel from the server to the user (this is called latency).
So, if your site is hosted in a datacenter in Houston, Texas, someone in California may not experience page load times so different from someone in Dallas, Texas, but a visitor from Norway or Japan might notice a slight lag or even deterioration in the quality of the data received.
There’s also the problem of network congestion. When a server gets more requests it can handle, the result is a bottleneck and the server may crash (figure 1).
A CDN helps minimize network latency and congestion by easing the load on the primary or origin server (figure 2). The CDN’s distributed servers (also called “nodes”) would store or cache copies of a website’s static content – such as text, images, videos, stylesheets, and script files – especially those most in demand. In effect, the website’s static content gets mirrored in multiple locations all over the internet.
Then when a user browses to the site, the CDN software determines the user’s location, and routes the user to the nearest server, which has the static files ready. This way, content loads really fast, and the origin server only has to deal with dynamic content requests.
An Analogy: Pizza Delivery
A good way to understand how CDNs basically work without going very technical is to think of pizza delivery for a large chain like Pizza Hut or Domino’s:
- A customer rings the pizza chain’s delivery number. (A request to the server)
- A staff answers the call and determines the store branch closest to the customer, then forwards the order to that branch. (The CDN routing the request to the nearest CDN server)
- The closest branch, having the same pizza dough, toppings, and other ingredients, will serve a pizza identical to what the customer had ordered at another branch while on travel. (The CDN server closest to the user browsing the site)
- The pizza doesn’t have to come from the main branch. (Packets travel the shortest distance and arrive faster, fewer hops across the network, lesser chance of packet loss while in transit)
- The pizza arrives still hot and customer is quickly gratified. (Fast delivery, optimum quality and performance)
Aside from improved site performance and faster load times (from the user’s viewpoint), CDNs help:
- Ensure your site’s continuous availability
- Make your site reach a global audience
- Make it easier for you to scale your operations
- Secure your site from denial of service attacks
- Back up your site
- Make your site accessible by multiple devices or platforms
- Improve your SEO
- Reduce cost in terms of building or leasing more powerful hardware and infrastructure to accommodate increased demand for your content
- Enhance your standing among your users/customers
Should you get CDN for your site?
Despite the benefits, not every website has to be on a CDN. For one, most CDN services aren’t free; even the free ones come with limitations. For another, if you’ve signed up with a reliable, high-performance web host, your hosting plan may already got your needs covered.
Who needs a CDN
- Ecommerce sites
- Gaming sites
- Social networks
- Video streaming sites
- Download sites
- Internet TV
- Web apps (e.g., Dropbox, Asana)
- High-traffic websites with millions of users all over the globe
- A website focused on local audience (for example, a local online newspaper)
- New, low-traffic sites
- Personal blogs
Choosing the Right CDN Provider/Vendor
There are many CDN vendors out there, and many of them would specialize in specific aspects of CDN. Enterprise-level CDNs like Akamai are powerful and cutting-edge but are too expensive and unsuitable for individuals and starters. However, there are several low-cost options, too.
One popular option that offers a free plan is CloudFlare. While limited, their free plan provides good speed and performance boost, as well as basic protection from DDoS attacks. Other affordable solutions worth checking out are MaxCDN, Incapsula, and Swarmify.
Before deciding on which CDN provider to sign up for, make sure you exercise the same care as when choosing a web host: shop around, compare features and pricing, look for guarantees and refund policies, check their customer service, and if possible, try the service before you buy.