
Rolling your own CDN for $25 in 1 hour - mxpxrocks10
http://www.scalescale.com/rolling-your-own-cdn-build-a-3-continent-cdn-for-25-in-1-hour/
======
natch
Nice. For tutorials like this it would be nice to see more details on the
"how" of each step. For example:

"We setup DNS info to point here (both NS1 and NS2..."

That's great, but it would be nice to see:

"Using the geodns web-based configuration tool, we setup DNS info to point
here (both NS1 and NS2..."

or

"Running <insert full command line here including tool and all options used
here> on <insert environment here>, we setup DNS info to point here (both NS1
and NS2..."

or

"By editing /etc/<file> on the <some environment>, we setup DNS info to point
here (both NS1 and NS2..."

In other words specifics are always really great to include.

But still this was a really great writeup, not just for the overview it gives
of one lightweight approach but for the comments it has kicked off.

~~~
acoyfellow
I think Genius and DigitalOcean = a match made in heaven. The quality would go
from "the best" to "untouchable", if the comments were value adding. Imagine
being able to dive deeper into any piece of the tutorial you wanted.

~~~
tmaly
not to sound like a n00b, but what is Genius in your context?

~~~
khalidmbajwa
I think he means Genius the company (formerly RapGenius) which annotates the
web. ([http://genius.com/](http://genius.com/))

~~~
tmaly
oh ok thanks, I thought that, but I was also thinking maybe it was some tech
stack like a docker container for a moment.

------
xxdesmus
I'd recommend CloudFlare if you want AnyCast geo-DNS, and a free CDN. We don't
charge for bandwidth or our DNS service.

Disclosure: yes, I work at CloudFlare but the previous details are simply
facts.

~~~
kawsper
Do you have a link to CloudFlare geo-DNS? I have multiple servers in multiple
parts of the world, and didn't know that Cloudflare supported that.

~~~
xxdesmus
CloudFlare uses AnyCast. We'll route any incoming requests to the nearest data
center automatically. [http://blog.cloudflare.com/a-brief-anycast-
primer](http://blog.cloudflare.com/a-brief-anycast-primer) No additional
configuration required.

If you're referring to making different origin calls based on the geographic
region -- such as when we go back to your origin for a request hitting our LAX
data center if you happen to have an origin near LAX we'd use that origin
specifically versus your other origin which might be located in let's say LHR.
We currently only support that functionality for our higher end enterprise
contracts. The functionality will likely to be available for other plan levels
in the future though.

~~~
pyvpx
anycast does not route to the geographically nearest datacenter but the
topologically nearest. anycast is great, but it isn't magic.

I get it: you have marketing folks that probably specifically told you not to
delve into the details but let's face it..."anycast routes it to the nearest
datacenter automatically!" isn't completely true.

~~~
jbb555
Surely topologically closest is most often what you want anyway?

~~~
pyvpx
sure, 80-90% of the time you get exactly what you want. but depending on your
application and use-case, 10% can be a deal breaker of sorts.

not that Geo location from notoriously inaccurate whois data is any better.

~~~
mxpxrocks10
yeah, if you're only controlling one side of the conversation you just have to
deal with the limitations. We use a lot of data from RUM measurements to
further tune things.

That being said, if you control both sides you can do some better stuff (ie:
Aspera, Netflix clients, etc) you can really ensure accuracy. Please feel free
to post any good links to this stuff.

------
kbar13
rolling your CDN on VPS instances isn't exactly cost-effective, and is
probably more of an exercise for fun than anything else. Unless you need
features out of your CDN that you can't get from existing CDN providers, I
don't really see the point.

also kind of unusual that this blog post is by the president of MaxCDN.

~~~
pushrax
Actually, with DigitalOcean, you get quite a lot of bandwidth for the price.
Additionally, their transfer limits are high (1TB for the $5 instances), and
overage is only $0.02/GB. If you combine this with something like Route 53's
anycast latency-routed DNS, it can work very well.

~~~
chrisan
with DigitalOcean they ask you do not run a CDN:
[https://www.digitalocean.com/community/questions/do-you-
have...](https://www.digitalocean.com/community/questions/do-you-have-a-fair-
usage-policy-for-bandwidth)

~~~
caw
I'm assuming that's a paid CDN with clients like CloudFlare or Akamai, not you
distributing your website to multiple datacenters in order to serve more
clients faster. If you happen to use CDN like DNS features to route the client
to the closest Digital Ocean datacenter, you're probably in the clear.

~~~
chrisan
Good point. I wonder if they meant "we ask you don't run a CDN _service_"
rather than just a CDN for your website.

Afterall, what is the difference between serving assets out of your webserver

------
akerl_
I'm more than a little bit concerned that the article doesn't point out the
serious risk of running a single DNS server for the records.

I get that they're trying to keep things simple for their demo, but
unsuspecting folks following this guide are in for quite a shock when their
GeoDNS is taken out by a single physical server fault.

~~~
mxpxrocks10
added this to the article in the "Todo" section. thanks for the feedback.

~~~
Lennie
In similar efforts, I also really enjoyed the slides from talk at DNS OARC
2014 about Anycast on a shoe string:

[http://www.slideshare.net/natmorris/anycast-on-a-shoe-
string](http://www.slideshare.net/natmorris/anycast-on-a-shoe-string)

------
edoceo
This is similar to the process I used to build
[http://gcdn.org/](http://gcdn.org/) which I and a few clients + friends use
on multiple projects. We used to use RR but GeoDNS has proven to be awesome
and reliable. Full NS control makes it easier to do rolling upgrades or
maintenance too. Excellent write up.

More notes on GeoDNS
[http://edoceo.com/howto/geodns](http://edoceo.com/howto/geodns)

~~~
umsm
This returns a 404-not found for me:

[https://gcdn.org/jquery/1.8.0/jquery.js](https://gcdn.org/jquery/1.8.0/jquery.js)

------
danielrhodes
I would highly recommend Varnish using S3 as a backend origin. Add to that a
few 100TB.com dedicated server and you have an extremely cheap CDN with pretty
decent bandwidth and minimal maintenance.

CDNs have the advantage that they control more of the stack so can do more
precise routing and have more edge nodes in more places. However, under the
right circumstances, you can take the above quite far before a real CDN
becomes necessary.

~~~
RKearney
100TB.com specifically forbids using their service to create a CDN in their
ToS[0].

    
    
        9. Acceptable Use/Illegal Activity
    
        d. We strive to maintain a high level of service, and a lot of
        customers depend on our high standards of quality. As such, we
        will not provide Services to those that are using our Services
        for:
        
        vii Using the Services for a content delivery network or content
        distribution network (CDN). An authorized CDN network offered
        through 100TB is accepted. Special requests to use the Services
        to run an unauthorized CDN network may be approved on a case-
        by-case basis. Failure to comply with this policy will result
        in termination of this TOS, and you will not receive a refund
        of the Fees.
    

[0]: [http://www.100tb.com/tos.php](http://www.100tb.com/tos.php)

~~~
ddorian43
people forget the story of simplecdn

~~~
danielrhodes
Just looked this up. Thanks for the tip!

------
AdamN
Now with libcloud
([http://libcloud.readthedocs.org/en/latest/compute/drivers/](http://libcloud.readthedocs.org/en/latest/compute/drivers/))
you can use multiple platforms in order to get all continents represented.

Including Africa ([http://kili.io](http://kili.io)) where I'm at.

~~~
mxpxrocks10
has anyone ever heard about these guys in South Africa:
[http://www.teraco.co.za/](http://www.teraco.co.za/)? Any other
recommendations for Africa and South Africa?

------
ColinCera
I'm wondering if it would be useful to plug groupcache into this. It's what
Google uses for serving downloads (e.g., Chrome downloads). Inherently
distributed and self-balancing. I might give that a try.

~~~
xin3td
Looks promising, but might need to add Doozer to the stack as groupcache has
an issue with maintaining a list of peers where the cached data is
distributed. Definitely worth looking into though.

[https://github.com/ha/doozerd](https://github.com/ha/doozerd)

------
fakeyfake
Reminds me of this article about hosting a CDN on digitalocean for the dash
documentation software.

[http://blog.kapeli.com/a-poor-mans-cdn](http://blog.kapeli.com/a-poor-mans-
cdn)

~~~
mxpxrocks10
cool - thanks

------
jpmonette
Definitely nice to see a real-world example of how to use Docker.

~~~
mxpxrocks10
woot woot.

------
Oculus
Cool article for understanding the basics of a CDN. What sort of page load
improvement can one get by adding geographically distributed servers?

~~~
mxpxrocks10
it can be quite a lot. you can test using a CDN or a setup like this and the
tools over at www.webpagetest.org (from Patrick Meehan - who is awesome) from
different locations.

------
ksec
Wouldn't it be better on Linode? Since they have wider selection of PoP. But i
wonder if the port speed would be a problem.

------
fmela
Thanks for sharing. Note that there's a typo in the link to Ewan's github
profile (should start with https, not ttps).

~~~
mxpxrocks10
thanks. will get it fixed shortly. this wasn't really scheduled for prime time
but started taking off. appreciate the feedback!

~~~
TheBiv
"This wasn't really scheduled for prime time, but started taking off"

:) You submitted the link to HN and that comment makes it seem like the post
accidentally took off!

~~~
mxpxrocks10
itchy trigger finger :-) didn't expect people to respond so well on a Sunday.

~~~
TheBiv
Just messing! :) Cheers

------
adarshr
Why is this page blocked by my UK work network?

~~~
Kudos
The people doing the blocking can probably better answer that.

------
lingben
or you know, if your concern is cost, go with cdn.net and pay as you go for a
kickass global cdn network

full disclosure, I have no business or personal connection to them

~~~
Kudos
There's 6TB of bandwidth built into this home rolled solution. That's going to
cost at least $350 at cdn.net.

~~~
lingben
you're comparing apples to oranges

------
leapius
Excellent tut!

------
hiddenpearls
that's awesome +Chris

