Turn Google App Engine into your own Personal Content Delivery Network (CDN)
As anybody who has run a growing website or blog knows, response time is going to get worse with the more users you have visiting your site. The users come from all angles, RSS feeds, homepage visits, search engine visits, people sealing your static files that you host, and pretty much anything else that can be served over HTTP. The solution to this problem is to off load your static content on to a Content Delivery Network or CDN. CDN providers cost a lot of money though, so it is nothing for us mere mortals with one server can afford.
But thanks to Google anyone can now run their own CDN for free on Googles servers. Lucky for you and me Google has made the process really painless and you can even have the CDN under you own domain name. In my case static.coderjournal.com.
What Is A Content Delivery Network?
According to Wikipedia:
A content delivery network or content distribution network (CDN) is a system of computers networked together across the Internet that cooperate transparently to deliver content most often for the purpose of improving performance, scalability, and cost efficiency, to end users. The first web content based CDNs were Speedera, Sandpiper, Mirror Image and Skycache, followed by Akamai and Digital Island.
Basically it is a network of computers around the world that serves your content to the end user closest to one of those many servers around the world. This method of delivery cuts down on server overload, DNS hops, and delivery time.
When sites like Microsoft, Yahoo, Google, or Amazon delivery content they use Content Delivery Networks (CDN’s) to host most of their content, especially static files such as images, stylesheets, downloads and anything else you can think of. The reason they do this is to reduce load on their application servers, that serve dynamic content, such as PHP or ASP.NET pages.
What Is Google App Engine?
So you may ask what is Google App Engine:
Google App Engine lets you run your web applications on Google’s infrastructure. App Engine applications are easy to build, easy to maintain, and easy to scale as your traffic and data storage needs grow. With App Engine, there are no servers to maintain: You just upload your application, and it’s ready to serve your users.
You can serve your app using a free domain name on the
appspot.comdomain, or use Google Apps to serve it from your own domain. You can share your application with the world, or limit access to members of your organization.App Engine costs nothing to get started. Sign up for a free account, and you can develop and publish your application for the world to see, at no charge and with no obligation. A free account can use up to 500MB of persistent storage and enough CPU and bandwidth for about 5 million page views a month.
Google has also announced a very very affordable price plan that any mere mortal can afford. They are not ready to start charging people yet, but here are the details:
- $0.10 – $0.12 per CPU core-hour
- $0.15 – $0.18 per GB-month of storage
- $0.11 – $0.13 per GB outgoing bandwidth
- $0.09 – $0.11 per GB incoming bandwidth
How do I setup my own CDN using Google App Engine?
To use Google App Engine you need to do a couple things that readies you computer to publish your static content to Google. Please take note that my setup is for Windows, but you can easily modify the process for any other OS.
Setup
- You need to download and install Python on your computer. You may already have it if you are using a Unix environment (i.e. Linux or Mac OS X). If you need to download it or would just like to check to see if it is up to date, please visit http://www.python.org/download/ and download the correct version for you operating system.
- Install Python to
c:\Program Files\(all my scripts that I have designed to make the publishing to Google are going to be using this path). - You will also need Google App Engine SDK which is available at http://code.google.com/appengine/downloads.html. Download the version that is for you OS. Note that the SDK will check for the Python install, so make sure you install it before the SDK.
- Sign up for Google App Engine at http://appengine.google.com/, you will need a valid Google account. I suggest you sign up for a Google Apps account and use that as your Google account. Why I suggest this will become apparent later on.
- Once you are done with the setup process you need to create an application. Click the “Create an Application” and give your application a name (called “application identifier”). This is a unique name for all Google App Engine applications. For example I set my application identifier to “coderjournal”. Click though to the next part of the application, if this is your first time registering an application you need to specify your cell phone number and confirm your account with a SMS code that Google sends you.
Publish To Your CDN
- Download my publishing files, hosted on my CDN, at http://static.coderjournal.com/downloads/coderjournal-cdn.zip
- Create a directory on your computer specifically for you CDN files. My directory is
c:\websites\static.coderjournal.com. Fill this directory with all your static files you want hosted on your CDN. Fill it full of all your css, downloads, flash, images, javascripts, videos, and anything else you want hosted. - Unzip the files I provided to you in step 1 into the directory you created in step 2.
- Next we need to edit the YAML configuration file. Open the
app.yamlfile in your favorite text editor and changeapplication: coderjournaltoapplication: {your application identifier}. - Next go down and edit your static directories, in mine I have css, downloads, flash, images, and js. You can create your own by just modifying the ones I put in the file.
- If you installed the Google App Engine SDK in the default directory and Python in
c:\Program Files\then skip to step 7. The next part is also required if you are using the x64 version of Windows, because Google App Engine SDK installs inc:\Program Files (x86)\. So change the paths inpublish-cdn-coderjournal.batto your actual paths. - Now double click on
publish-cdn-coderjournal.batand a command window will display. Fill in your Google account and password that you used to sign up for the Google App Engine account. And you content will start to publish. - You now have you own private CDN that can be accessed at http://application-identifier.appspot.com.
Using Your Own Domain (Optional)
- If you created your own Google App as suggested up in Setup step 4, you can create your own custom domain for your CDN. If you didn’t, don’t worry just create one, and follow the steps below.
- Go to the dashboard of your Google Apps and click “Add more services”.
- Under other services you will see Google App Engine and a place to enter your application identifier. Enter you application identifier and click “Add It Now”.
- It will take you to the next page where you enter in the domain you want for your CDN, I suggest something simple like
static.yoursite.com. - Then you just need to follow the steps for adding a CNAME to your DNS and you are ready to go with you custom domain.

How do I use my own CDN?
Well this is the cool part! You just use the absolute path to your files. For example if you wanted to host the image to your right you would just use the following in your HTML:
Potential Gotcha: I forgot to mention that currently the files hosted statically are case-sensitive. I have reported this issue to Google, hopefully they will correct it soon. http://code.google.com/p/googleappengine/issues/detail?id=466
<img src="http://static.coderjournal.com/images/ideapipe-logo.png" />
It is really that simple. Now comes the cool part that I need your help with, and proof that this is really a true CDN. I would like to see how many different IP Addresses my CDN points to. So far I was able to find the following IP addresses:
72.14.207.12164.233.179.12166.249.91.121
That point to:
static.coderjournal.com
To see what IP Address you get on your local machine just pull up the command prompt and type:
ping static.coderjournal.com
Please report your findings in the comments below. I am sure everybody would love to see how big Google’s CDN really is.
Tags: CDN, Content Delivery Network, Google App Engine, Google Apps








June 12th, 2008 at 7:45 am
Turn Google App Engine into your own Personal Content Delivery Network…
You’ve been kicked (a good thing) – Trackback from DotNetKicks.com…
June 12th, 2008 at 10:29 am
72.14.207.121
June 12th, 2008 at 11:05 am
72.14.207.121 here as well.
June 12th, 2008 at 11:16 am
Are you guys West Coasters? Because I got the 64 from a Delware hosting company. I got the 72 from my blogs box which is hosted by GoDaddy VPC. And the 66 I got from http://www.domaintools.com.
June 12th, 2008 at 1:09 pm
66 here. Denmark – Europe
June 12th, 2008 at 3:24 pm
Im getting 66.249.91.121 from Dublin, Ireland.
June 12th, 2008 at 4:45 pm
@Nick: I’m in Washington, DC, so nope. East Coast.
At work I was getting 72.14.207.121, but here at home I’m getting 64.233.179.121. I only live about 200 yards from my office, for what it’s worth…
June 12th, 2008 at 5:59 pm
@Troy
I have had the same experience. I am sort of curious how Google is breaking up their CDN. I have seen mixed results from all over the globe. I have heard of something called an elastic IP, maybe this is it. But I don’t know anything about the technology, so I won’t comment on it any further. Might make an ass of myself.
June 12th, 2008 at 8:57 pm
66.249.81.121 from Perth, AU
June 13th, 2008 at 8:25 am
Nick,
This is a great article for those wanting to use Google App Engine as a quasi CDN. I would not recommend any of these solutions as a true CDN as they are not an edge based solutions (providing downloads from servers closer to the user). The analytical reporting on objects stored in these services is very poor. Caching of objects using proper headers and etags is something you must build custom and requires great knowledge of browser caching strategies.
Anything free or cheap always has its drawbacks but for content that is not crucial to you business it will work fine. I would recommend many of the month-to-month CDN’s that are out on the market for content that is critical to your business.
June 13th, 2008 at 8:54 am
[...] Turn Google App Engine into your own Personal Content Delivery Network (CDN) As anybody who has run a growing website or blog knows, response time is going to get worse with the more users you have visiting your site. The users come from all angles, RSS feeds, homepage visits, search engine visits, people sealing your static files that you host, and pretty much anything else that can be served over HTTP. The solution to this problem is to off load your static content on to a Content Delivery Network or CDN. CDN providers cost a lot of money though, so it is nothing for us mere mortals with one server can afford. [...]
June 13th, 2008 at 10:52 am
66.249.91.121 from Lisbon, Portugal
June 14th, 2008 at 11:14 am
Just posted my thoughts on ‘Web Service for Content Distribution Network’ at http://tinyurl.com/6y3gqx. Would love to hear your thoughts on the same.
Thanks,
Mukul.
June 15th, 2008 at 9:19 am
I get 72.14.207.121 with a delay of 115ms from my home PC in Switzerland.
June 15th, 2008 at 5:30 pm
Remy,
What is the delay you get when you ping http://www.coderjournal.com?
June 16th, 2008 at 1:20 am
http://www.coderjournal.com 186ms
static.coderjournal.com 269ms
Traceroute to static.coderjournal.com from New Zealand, hops between me and the outside of the Auckland Peering Exchange commented out.
192.n.n.n
n.n.n.n
n.n.n.n
n.n.n.n
n.n.n.n
n.n.n.n
n.n.n.n
n.n.n.n
202.169.192.245
202.169.192.11
203.97.90.137
203.98.50.251
203.167.233.10
202.84.141.21
202.84.251.150
134.159.62.26
216.239.43.12
72.14.238.130
64.233.174.81
72.14.236.20
72.14.236.183
66.249.94.72
72.14.236.130
72.14.207.121
June 16th, 2008 at 2:24 am
more users you have visiting your site, the site will still crush down.
June 16th, 2008 at 4:32 am
Yes but I have raised the bar by off loading my static content outside of my site. My web server no longer has to handle the requests for the static images and be locked up while it is delivering that content. My site will only have to handle the traffic generated by the WordPress HTML delivery, that is the usefulness of a CDN.
June 18th, 2008 at 8:16 pm
[...] Turn Google App Engine into your own Personal Content Delivery Network (CDN) – Nick Berardi’s Code… Posted in Google. [...]
June 20th, 2008 at 3:53 am
[...] use for Google App Engine is a Content Distribution Network. Does that about cover it? I can still scale with PHP and scale the database as I’ll use [...]
June 27th, 2008 at 5:49 am
[...] looking around I found some Commercial CDN, an open source one or two, then I found a nice blog post about how to use Google App Engine to make your own [...]
June 30th, 2008 at 7:49 am
I got 66.249.91.121 from Vienna, Austria
Approximate round trip times in milli-seconds:
Minimum = 27ms, Maximum = 29ms, Average = 28ms
June 30th, 2008 at 11:14 am
> Potential Gotcha: I forgot to mention that currently the files hosted statically are case-sensitive. I have reported this issue to Google, hopefully they will correct it soon.
I don’t see how that’s a potential gotcha, isn’t that the common and desirable setting for most servers?
June 30th, 2008 at 11:15 am
72.14.207.121 from Quebec, Canada.
Same address from Washington, USA via SoftLayer.
June 30th, 2008 at 12:53 pm
What are the advantages of using the Google AppEngine over using a free CDN such as Coral?
coralcdn.org
From Southern California:
Pinging ghs.l.google.com [66.249.81.121] with 32 bytes of data:
Ping statistics for 66.249.81.121:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 76ms, Maximum = 80ms, Average = 78ms
Dave
June 30th, 2008 at 1:25 pm
Jeremy,
Actually it isn’t a common or desirable setting for most servers, Apache doesn’t have it enabled by default, and because of NTFS IIS doesn’t support it with out some work.
Most servers will let you request
http://somesite.com/images/xyz.png or
http://somesite.com/Images/XyZ.png or
http://somesite.com/IMAGES/xyz.PNG
and all point to the same file. I know that specification say one thing as a buy pointed out in my request to Google App Engine, but the common practice on the web is to have them not case sensitive.
June 30th, 2008 at 9:28 pm
Nick,
Apache is only case-insensitive when running on Windows, and that’s only because the underlying filesystem is case-insensitive. Why do you want this behaviour? You might not be interested in what the specifications say, but properly written clients (browsers, caches, accelerators, etc) need to follow them and they’d see your xyz.png URLs as three distinct resources. If you don’t stick to a consistent case convention in all your URLs then you’re slowing your sites down by harming their cacheability.
July 1st, 2008 at 1:13 am
[...] content delivery network … Came across this article and found it a pretty interesting read Turn Google App Engine into your own Personal Content Delivery Network (CDN) – Nick Berardi’s … Thought I’d share here. Prices seem quite interesting as well. __________________ Forbairt Media [...]
July 1st, 2008 at 6:04 am
Paul,
Honestly everybody is making a big deal about this. All that I was requesting was the option, and it should be pretty easy since Google uses Regex. Honestly standards aren’t worth a hill of beans, if people are referencing the resources in different ways, and you can’t always control the ways people reference your resources in a CDN.
Take for example Yahoo, with their API’s:
http://yui.yahooapis.com/2.4.1/build/menu/assets/skins/sam/menu.css
http://yui.yahooapis.com/2.4.1/build/menu/assets/skins/sam/menu.CSS
http://yui.yahooapis.com/2.4.1/BUILD/menu/assets/skins/sam/menu.CSS
http://yui.yahooapis.com/2.4.1/BUILD/MENU/ASSETS/SKINS/SAM/MENU.CSS
Yahoo tries to follow standards to the “T”, but some standards you just have to ignore because of the human factor, and because they might have made sense at the time but haven’t been updated for the times.
I am not trying to make this an us vs them thing, or a Microsoft vs Apache thing, but the truth is that resources through the URL and the HTTP protocol are better off and easier to use and reference when they are case-insensitive, and isn’t that what the web 2.0 movement is all about.
July 6th, 2008 at 6:45 pm
66.249.81.121 on the east coast of USA.
July 7th, 2008 at 12:23 pm
IP test from 2 computers here in Orlando, FL
1. First machine at work actually routes through our company servers in California so technically CA based machine IP I got is:
72.14.207.121
2. Second which is just off a local Orlando, FL network connection is:
64.233.179.121
119ms
Orlando, FL
July 16th, 2008 at 2:51 pm
Years ago I tried CoralCDN for images on a high-traffic website, and it failed really bad. Latency was a big issue, and it’d time out often.
Not sure if this is still an issue, but I’d be happy to read what everyone thinks about CoralCDN.
July 21st, 2008 at 3:06 pm
66.249.81.121 from Scottsdale AZ
October 2nd, 2008 at 8:42 am
72.14.235.121 from Tokyo
October 7th, 2008 at 3:03 am
74.125.47.121 from malaysia
November 20th, 2008 at 12:20 pm
66.249.91.121 – Fort Lauderdale, FL
December 9th, 2008 at 11:02 am
74.125.47.121 from Minnesota.
July 2nd, 2009 at 6:37 pm
74.125.53.121
September 8th, 2009 at 9:24 am
74.125.77.121 from Dublin, Ireland
October 16th, 2009 at 9:03 am
74.125.47.121
October 17th, 2009 at 1:05 pm
A good website to check out all the different IP addresses is at Just Ping.
http://just-ping.com/index.php?vh=static.coderjournal.com&c=&s=ping!
Which has ping sites around the world. According to this it looks like there is about 10 or more different IP at posting of this comment.
November 3rd, 2009 at 7:51 pm
74.125.53.121 from Malaysia at a latency of 188ms
November 30th, 2009 at 9:37 pm
74.125.43.121 at average 63ms
January 13th, 2010 at 3:51 am
This is a great article for those wanting to use Google App Engine as a quasi CDN
Just posted my thoughts on Cloudy combo Google App Engine and Amazon S3 combo pack
A few days ago i had written about some of my concerns with App. Engine,
January 26th, 2010 at 10:59 am
[...] I just noticed that my blog’s CDN (Google AppEngine) was failing to resolve. After a little research I realized that WebSense, a corporate web [...]