For marketers
who love technology
Home » , , » How to build your own content delivery network (CDN)?

How to build your own content delivery network (CDN)?

Have you ever wondered how content delivery networks (CDNs) work?

I will tell you a little secret: you can setup your own CDN with reasonable effort and a little budget (<1000$). It will not compete with Akamai just yet, but it is a great way to improve your website's performance and to learn more about CDNs.

How does a content delivery network (CDN) work?

A simple CDN is made of three nodes:
  1. The central node or request router is in charge of routing the requests to the right cache
  2. The cache nodes (a.k.a. caching proxies) contain copies of the hot content and request other content in case of cache miss
  3. The back-office node is in charge of all administrative tasks such as collecting logs, configuring the content delivery network (CDN)
There are two main redirection methods in CDNs to ensure content is served from the closest server: HTTP redirect and DNS. Have a look at my post on redirection in CDNs to understand the tradeoffs between these two methods.

Open-source software for content delivery networks (CDNs)

How can we implement these three types of nodes with just open-source software and on virtual machines, to limit the investments to a minimum? That's actually quite easy if you are used to administrating Linux systems:
  • Install your own caching proxies 
    • Squid and Lusca, are simple to install and to configure on any Linux host 
    • To test the proxies, configure your browser to use your proxy or use SSH tunneling capabilities to forward port 80 traffic to the caching proxy (there are plenty of tutorials on the web) 
  • Play with DNS servers to customize the resolution of some FQDNs, thereby building a request router 
    • Bind and PowerDNS offer the required features
  • Play with Awstats and other reporting tools to analyze cache logs
For the hosting, you can rent Virtual Private Server’s for less that 100€ a year…

Have fun! Most CDNs have started from open-source blocks… For instance, you can find inspiration in Netflix openconnect specifications, which detail Netflixin-housee CDN design.


About Gilles


  1. Great One.
    As we all know it plays an important part in the conversion. Using CDN is also very beneficial. There are new technique in your blog that I was not aware of thanks for this info.I can suggest a blog on page speed optimization by choosing best Content delivery network I recently found it’s a good one