Under attack? IT Try it free
Blog · CDN & speed

What a CDN is and when you really need one (even for a small site)

A CDN brings your site close to its visitors, makes it faster and protects it from attacks. How it works, what it caches, what it costs and when it's really worth it.

A CDN (Content Delivery Network) is a network of servers spread across several cities that sits between your site and its visitors. Instead of all connecting to your server, visitors connect to the nearest node, which already has a copy of the pages and files ready. The result is a faster site, a less loaded server and an extra layer of protection against attacks.

How it works, without jargon

Imagine your site is a warehouse in one city. Without a CDN, every customer, however far away, has to travel to that warehouse to pick up their goods. With a CDN you open pickup points in other cities: the most requested products are already there, and customers travel much less.

In technical terms:

What gets cached, and what doesn't

Always cached: images, stylesheets (CSS), JavaScript, fonts, videos, PDFs. They rarely change and they're heavy: they make up most of a page's megabytes.

Cached with care: public HTML pages, such as articles, product pages and categories. They can be cached for a few minutes or hours, and the cache purged when they change. Many CMSs do this automatically on every publish.

Never cached: personal pages (cart, account area, payment) and anything that depends on who is looking. A well-built CDN recognises them: on 1PrimeCDN, pages requested with a session cookie and requests with credentials always go to your server.

What it's really for

Speed

Distance matters: every round trip between a visitor and a faraway server adds tens of milliseconds, and a page makes dozens of them. A nearby node shortens everything. Even more important, the node answers with a ready-made file, while your server would have to build it.

Handling spikes

When an article goes viral or a campaign starts, the CDN delivers the same page to thousands of people while your server builds it only once. It's the difference between a site that survives success and one that goes down at the best possible moment.

Protection

Attacks reach the nodes, not your server. The nodes filter bots, limit anyone overdoing it and sit in data centres with network-level anti-DDoS protection. And if your server stops answering for a while, the nodes can keep serving the last cached copy of your pages.

Less traffic on the server

If most files come from the cache, the server uses far less bandwidth and CPU. On hosting with traffic or resource limits, that's a direct saving.

When you need it (and when less so)

You almost always need it if:

It matters less for a tiny site with few visitors, all in the same city as the server. Even then, though, attack protection and automatic HTTPS alone may be worth the move.

What it costs

CDNs are almost always billed by traffic: a price for every gigabyte delivered by the nodes. With 1PrimeCDN the price is €0.012 per GB, with no per-request costs and no monthly fee. To give you an idea: a site delivering 100 GB a month spends just over one euro.

How to switch it on

Two steps are usually enough:

  1. create a Pull Zone, i.e. tell the CDN where the site's origin server is;
  2. point the domain at the nodes, by changing the nameservers or a single DNS record.

From then on visits go through the nodes, and HTTPS certificates are issued and renewed automatically. You should then close the origin server to everyone except the nodes, as we explain in why your server's IP must be hidden.

The 1PrimeCDN network

1PrimeCDN has 6 nodes in Europe, on four different providers: Gravelines (France), Limburg and Falkenstein (Germany), Helsinki (Finland), Arezzo and Milan (Italy). Managed DNS has nameservers on several providers and cities, and the panel is available in English and Italian. If you'd like to try it on your site, write to us.

Want a site that holds up even under attack?

1PrimeCDN puts your site behind 8 European nodes with caching, HTTPS and Shield against bots and attacks. Fixed monthly price from €9.90.

Let's talk