RESEARCH 》 Building my own CDN - Finally Completed - Update: 17-Dec-2017

Today I finally completed building my own private CDN. As I discussed so far in my earlier topics (Building my own CDN), I want to custom build the same step-by-step from scratch. And I don't want to for now use/buy third-party CDN subscriptions from Akamai, CloudFlare, Limelight, etc as I discussed earlier.

As you know The TOFFEE Project (or TOFFEE) is a fork of my TrafficSqueezer WAN Optimization project. I still have/own the TrafficSqueezer domain which is But ever since I started the The TOFFEE Project fork (and the website), I did a direct domain redirect to the new registered But now recently I got a new hosting from GoDaddy, so once again I linked the old domain (i.e. to that new hosting. Hence now I have a fresh initial welcome page in the mentioning about the project status. And it automatically redirects the users to the new The TOFFEE Project website (i.e., as you can see in the screenshot below). Other than this, the website is completely empty. Which means I can use the hosting space for other important situations like in this case to build my own private CDN for the website.
01 Building my own CDN for TOFFEE website - empty TrafficSqueezer website

Creating a new sub-domain to host my new CDN
So I went ahead and created the new sub-domain in my GoDaddy portal (as shown below) to host the CDN within the same so that it is sort of isolated from the main website context. It also makes easy to track the GoDaddy cPanel Awstats and so on.
02 Building my own CDN for TOFFEE website - - sub-domain to host my new CDN [CDN]
03 Building my own CDN for TOFFEE website - - sub-domain to host my new CDN

When I create this sub-domain, I have a choice, suppose if I have more websites, I can even instead create sub-domain names such as cdn-the-toffee-project-org and so on, so that this way we can have each CDN sub-domain created for a dedicated remote site. But in my case I would like to keep things simple at this point so I created for now a single sub-domain such as and hosted(copied) the images and other web-resources within the same.

So with this thing in place, I now changed my main website scripts so that they point these resources dynamically as per the mode I want. Such as:

  • Always CDN mode
  • Load-Sharing CDN mode
  • No CDN mode (or Disable CDN mode)

Unfortunately, for security reasons I am not interested to share this logic(my exact code). But anyways I hope you get the idea how it can be done. The Always CDN mode allows registered resources (images/scripts/etc) to get incorporated always via CDN for each page request. While the load-sharing CDN mode gives me the flexibility to use CDN resources fairly. And this way if I choose to host in other CDNs in future such as this, I can dynamically point to CDN of my choice dynamically in a sort of round-robin fashion. But for now since I have only one CDN, sometimes the images(and resources) will be served from CDN sources and sometimes it will be served locally via server itself.

Last but not least I did the No CDN mode or Disable CDN mode as a precaution so that if something goes wrong or if the CDN site is down, the whole CDN stuff can be disabled. Even this can be automated by incorporating some sort of remote discovery and intelligent switchover to avoid any catastrophe!

So as you can see here are some few screenshots where at times some are getting fed via CDN and at times they are getting fed by itself (i.e no CDN). Since it is still work in progress, to debug the same, I have incorporated this dynamic " [CDN]" string in the image title and image alt, so that it gives me a clue if the system is all working fine. And I should able to distinguish the image source.

Here are some of the screenshots. Notice the image title when I hover the mouse pointer above the same:

Image/Resource not fed via CDN (below):
04 Building my own CDN for TOFFEE website - - checking if the resource is fed via CDN [CDN]

Image/Resource fed via CDN (below):
05 Building my own CDN for TOFFEE website - - checking if the resource is fed via CDN

Image/Resource fed via CDN (below):
06 Building my own CDN for TOFFEE website - - checking if the resource is fed via CDN [CDN]

Image/Resource not fed via CDN (below):
07 Building my own CDN for TOFFEE website - - checking if the resource is fed via CDN

And yes, like I discussed in my earlier CDN topic (How to check a website using CDN ?), you can do a view source of any of these pages (as shown below) just like Facebook, Twitter, etc, and get an hint whether a website is using CDN or not.
08 Building my own CDN for TOFFEE website - - check if a website is using CDN

Like I discussed in this case it is not so sophisticated or complex like subscription based CDNs like what you get via CloudFlare/Akamai and so on. But instead this is a pure private custom-built CDN. And kindly note, even CDN technology is a sort of (or a specific category of) WAN Optimization technology. But it is not a mundane WAN Optimization technology, instead it comes under one among the Internet Optimization Technologies.

At times I do offer consultation on this regard to my clients across the world. And hence in case if you are looking forward for any expert advice or any other consultation on this regard you can contact me via email provided in the contact page.

Suggested Topics:

Generic CDN

Building my own CDN

💎 TOFFEE-MOCHA new bootable ISO: Download
💎 TOFFEE Data-Center Big picture and Overview: Download PDF


My sample Wireshark packet capture files for research ↗
Saturday' 13-Mar-2021
I have a huge repository (or collection) of sample Wireshark packet capture files for reference. I use them extensively for research and development of TOFFEE as well to understand various protocol PDUs and protocol standards. I personally collected various test captures via Wireshark during my test and experimental research setup during the course of TOFFEE development. Say if you are a student and learning Networking and or say VoIP data and VoIP packets, you can analyse my VoIP sample Wireshark captures. Or in other case assume you are doing some quick research (or development) and want to refer few handful of VoIP packets then you can download and analyse my sample packet capture files.

TOFFEE-Butterscotch Bandwidth saver software development - Update: 28-Oct-2016 ↗
Saturday' 13-Mar-2021
Here is my first software development update of TOFFEE-Butterscotch. In my first TOFFEE-Butterscotch news update I have introduced about TOFFEE-Butterscotch research, project specifications, use-cases, etc. Introducing TOFFEE-Butterscotch Alerts: These are simple packet counters which corresponds to the filter type. For example if the incoming TCP-SYN packets are blocked then its corresponding alert counter will increment whenever such a packet arrives and gets filtered (dropped).

TOFFEE-Mocha WAN Emulation software development - Update: 16-June-2016 ↗
Saturday' 13-Mar-2021
I started TOFFEE-Mocha WAN Emulation software development on 1-June-2016. I took the existing TOFFEE components as a base. Although the TOFFEE-Mocha is entirely an independent fresh Open-Source WAN Emulation solution. Ever since I am in the process of defining and inventing features. So far I come up with the most important feature which is expected to be present in any WAN Emulation software is the packet delay option.

Bitcoin Mining - Blockchain Technology - Network Optimization via TOFFEE Data-Center WAN Optimization ↗
Saturday' 13-Mar-2021
Bitcoin Mining - Blockchain Technology - Network Optimization via TOFFEE Data-Center WAN Optimization

Building my own CDN - choosing a web-hosting to deploy my CDN - Update: 28-July-2016 ↗
Saturday' 13-Mar-2021
The TOFFEE Project website is hosted on Inmotion Hosting. And so I am looking for alternate hosting provider to build my first CDN node. My plan is to make multiple sub-domains of my website such as, and point each of this corresponding subdomain(s) to various alternative web hosting servers geographically spread across the world. Sometimes choosing the same vendor for multiple CDN nodes may result multiple servers existing in the data-center. And this becomes an issue if there is some catastrophic network disaster.

TOFFEE-Mocha Documentation :: TOFFEE-Mocha-1.0.14-1-rpi2 - Raspberry Pi WAN Emulator ↗
Saturday' 13-Mar-2021

Tweaking Network Latency - Live Demo - via TOFFEE-DataCenter ↗
Saturday' 13-Mar-2021

TOFFEE deployment topology guide ↗
Saturday' 13-Mar-2021
Assume you have two sites (such as Site-A and Site-B) connected via slow/critical WAN link as shown below. You can optimize this link by saving the bandwidth as well possibly improve the speed. However, the WAN speed can be optimized only if the WAN link speeds are below that of the processing latency of your TOFFEE installed hardware. Assume your WAN link is 12Mbps, and assume the maximum WAN optimization speed/capacity of Raspberry Pi is 20Mbps, then your link will get speed optimization too. And in another case, assume your WAN link is 50Mbps, then using the Raspberry Pi as WAN Optimization device will actually increase the latency (i.e slows the WAN link). But in all the cases the bandwidth savings should be the same irrespective of the WAN link speed. In other words, if you want to cut down the WAN link costs via this WAN Optimization set up, you can always get it since it reduces the overall bandwidth in almost all the cases (including encrypted and pre-compressed data).

Tracking Live Network Application Data - in a WAN Acceleration (WAN Optimization) Device ↗
Saturday' 13-Mar-2021

TOFFEE-DataCenter with GlusterFS Storage Cluster ↗
Saturday' 13-Mar-2021

Featured Educational Video:
Youtubeで見る - [830//1] x248 Part Time (or Consulting) Jobs - Developer/Programmer ↗

TOFFEE-DataCenter as a VNF for NFV ↗
Saturday' 13-Mar-2021

TOFFEE-Mocha-1.0.32-1-x86_64 and TOFFEE-Mocha-1.0.32-1-i386 Code Release ↗
Saturday' 13-Mar-2021
This is my first TOFFEE-Mocha combined x86-64 and i386 (Intel x86 64-bit and 32-bit) code release.

TOFFEE (and TOFFEE-DataCenter) deployment with VPN devices ↗
Saturday' 13-Mar-2021
In case if you need to deploy TOFFEE along with your existing VPN devices you can deploy the same as shown below. This will allow your VPN devices to encrypt your TOFFEE WAN Optimized network data. NOTE: Make sure about the VPN deployment topology done in the right order. Else TOFFEE (LAN side) may get VPN encrypted packets which may not be possible (and or difficult) to further optimize. Hence always make sure to deploy them in a topology suggested below so that TOFFEE devices are out of VPN tunnel.

Demo TOFFEE-DataCenter WAN Optimization packaging feature ↗
Saturday' 13-Mar-2021

Off-Grid Home Lab Research Solar Installation ↗
Saturday' 13-Mar-2021

Research :: Optimization of network data (WAN Optimization) at various levels:
Network File level network data WAN Optimization

Learn Linux Systems Software and Kernel Programming:
Linux, Kernel, Networking and Systems-Software online classes

Hardware Compression and Decompression Accelerator Cards:
TOFFEE Architecture with Compression and Decompression Accelerator Card [CDN]

TOFFEE-DataCenter on a Dell Server - Intel Xeon E5645 CPU:
TOFFEE-DataCenter screenshots on a Dual CPU - Intel(R) Xeon(R) CPU E5645 @ 2.40GHz - Dell Server