September 13, 2010 by Ivan Kristianto
Host Your Static Files Using Google App Engine For Free
Google App Engine is cloud computing technology for developing and hosting web applications in Google-managed data centers. It virtualizes applications across multiple servers and data centers. And the good things is Google App Engine offer you a trial for free. And offer reasonable price if you have over quota. It is $0.12/GByte for outgoing bandwidth.
So what will you achieve if your site using Google App Engine to host your static files? Google data store are spread all over the world. And if you store you static files on Google App Engine, it will maximize your website speed and performance, since it will serve static files from the nearest location for your visitor. And the results are reduce your CPUs load and memory usage, save bandwidth, and speed up your website performance.
Google App Engine Setup step by step
1. First you have to have a Google account, if not registered it first, mobile phone verified need.
2. Sign up for an Google App Engine Application, go to http://code.google.com/appengine/. Mobile phone verified might be need again.
3. Create a Google App Engine Application:
4. Now download Python and Google App Engine SDK. (Download available at the end of this article.)
5. Install both Python and Google App Engine SDK.
6. Open Google App Engine Launcher, you might be need to configure it for first time. Go to Edit Preferences.
7. Create new application, File > Create New Application, Fill Application Name (should be same as Application identifier when you create the app engine), then choose where your file will be saved.
8. After you create the application, then now you need to edit the app.yaml file. Mine looks like this:
application: ivan-kris version: 1 runtime: python api_version: 1 default_expiration: "7d" handlers: - url: /images static_dir: images - url: /styles static_dir: styles - url: /static static_dir: static
Explanation: default_expiration means how long the static file will expired on visitor’s browser cache. Then i created 3 static directory: images, styles and static. For more information go to Python Application Configuration.
9. Now go to your application directory and create the folder that you define in app.yaml. For my configuration i will create images, styles and static directories.
10. Copy your static files into the directory. Don’t forget to change you css file to get the images url to: http://[app-id].appspot.com/[images|styles|static].
11. Deploy your application, just press the button Deploy on the toolbar.
12. Update your Website themes to get the css style from Google App Engine.
13. Test your website, maybe you need a couple of tweak. Firebugs Firefox Extension highly recommended for this.
14. It’s all done.
My result after using Google App Engine and couple optimization is:
The home page loading is 6.23s (onload: 6.27s) – tested using Google Page Speed tools.
The home page loading is 4.590s – tested using WebPageTest.
So how about yours? Post your result in my comment. Cheers and good luck.