Adventures in WordPress Vol. 5 - CDN

One of the last things to tackle for the moment is setting up and managing a CDN or Content Delivery Network.

Before picking a CDN provider I needed to get an estimate on how much traffic the site was using. Luckily there's a console based network traffic monitor for Linux called vnStat.

To enable vnStat just requires one command;

vnstat -u -i eth0

Checking the estimate using vnstat -d showed that we'd be sending about 300GB this month, yikes.

                rx      |     tx      |    total    
estimated    345.95 MiB |    9.04 GiB |    9.37 GiB

But thankfully after a few days of gathering data the estimate became a more reasonable 120GB per month.

➜  ~ vnstat --months

 eth0  /  monthly

       month        rx      |     tx      |    total    |   avg. rate
      Jun 16       3.50 GiB |  119.66 GiB |  123.17 GiB |  398.61 kbit/s  
      Jul 16       6.51 GiB |  147.34 GiB |  153.85 GiB |  481.84 kbit/s
      Aug 16       3.94 GiB |   62.99 GiB |   66.93 GiB |  209.62 kbit/s  <- CDN enabled here
      Sep 16      20.39 GiB |   31.93 GiB |   52.32 GiB |  182.52 kbit/s

After doing some searching and consulting with Nicole, we decided to give MaxCDN a try. Their 9$ for 100GB looked to be a reasonable price for the amount of traffic the server was receiving.

The entire process from signing up to enabling the CDN was super easy and only required 2 settings to be configured.

The only step that wasn't required was adding a CNAME DNS entry for cdn.bittenbythetravelbug instead of [long hash], this keeps things tidy and well presented to end users who snoop around the sites source code.