Photos Spare Cycles MythBusters

Google App Engine: Some early tips

appengine_lowres.jpgI'm not an advanced user of Google App Engine, but I did make some mistakes at the start that I had to pay for later on. All of these mistakes are simple and easy to avoid, so I thought I'd share some tips for others looking to wade into App Engine waters (thanks to bp for rescuing me from early mistakes).

Use memcache from day 1

With most apps you can write first, optimize later. Google App Engine's quotas including quotas for high CPU usage, which you can go over very quickly. Right after my site deployed I started getting some hits from StumbleUpon -- it was sad seeing my site disabled so soon after its birth.

The Memcache API is ridiculously easy to use, so thankfully optimizing is not difficult. It's basically just a string dictionary. Build your code to make as much use of this API as possible.

Limit your query result sizes

Big query results will hammer your quotas, so do whatever you can to make sure you work on small result sizes.

Take the time to watch the tutorials

You'll be productive quickly enough, so take some time to watch the tutorial videos to get a better understanding of how App Engine and Big Table work. It can help you figure out how to design your model better. For example, learn what entity groups are early on so you can decide whether or not you should use them.

Use source code management

You'll be up and running in no time with App Engine, so you have to be even more careful with your source code. Early on I found it far too easy to start hacking in a new feature into my code and breaking it -- which meant that I couldn't make any other updates to my site until I got it working again.

Keep your queries in a few places

App Engine's APIs make it really easy to do queries, in fact, too easy. It also automatically creates indexes for you based on your queries. You'll soon find queries scattered in every bit of your code and you'll be wondering why you suddenly have so many indexes.

Your better off consolidating your queries in a few places so you can keep track of what sort of queries you're doing and possibly eliminating some in order to reduce your indexes. This will also make it easier to invisibly throw memcache on top so that your higher-level code doesn't have to know if its dealing with the datastore or the cache.

Post a comment


related entries.

what is this?

This page contains a single entry from kwc blog posted on July 12, 2008 3:56 PM.

The previous post was One week of Google App Engine.

The next post is It's ginormous II.

Current entries can be found on the main page.