Tuesday, September 16, 2008

GDD08: A Deeper Look at Google App Engine

It was a long walk between the keynote room, dubbed Space Invaders, and the App Engine talk here in Donkey Kong, and Google has set up a number of feeding stations along the way for weary developers...


Mano Marks talking about App Engine

But I'm now in "A Deeper Look at Google App Engine" given by Mano Marks.

We've got the first estimate so how much App Engine is going to cost above and beyond the amount Google is giving away for free, about US$40 if you use double the amount of traffic in your preview allocation. There is also support for cron'd jobs, SSL and other languages, apart from Python and presumably the already semi-public effort to port Perl to App Engine, coming soon.

After a brief discussion about what Mano can't talk about, mostly when new languages are coming to App Engine and what those languages will be, we've dived directly into the code, and we're looking through the example that will be used in the App Engine code lab this afternoon. Which I still haven't decided whether I'll go to yet...

We're talking about Bigtable, the storage mechanism underlying App Engine, and Mano is really trying to emphasize that it's not a relational database, it's an object orientated (schema-less) database.

After running through request handlers and entities, we're now talking about counters. One major difference between relational database and a distributed datastore like Bigtable. Bigtable doesn't know counts by design, must scan every entity row. Google is encouraging developers to create a separate entity that you can increment every time a entity is inserted, and decremented every time one is removed. However if you're doing frequent updates you'll end up with a requests queuing up to update the counter. The solution is to use a sharded counter. You create a number of shards, and when you go to increment the counter you pick a entity at random. Mano is now running through how this works in practice...

Mano is showing an implementation of sharded counters using Bigtable and memcache, I'm wondering why this isn't available as a default Google library so is just becomes the way counters are done with Bigtable..?

...and we're out of slides, opening the floor to questions the first one is exactly that. Why aren't counters built into Bigtable? The answer is, "good question". They're trying to keep the environment as clean a Python environment as possible, but I'm not entirely convinced that answers the question?

Interestingly, the recommended work around for the lack of cron support is to set up a remote call that polls a known end point inside App Engine periodically. However you need to remember that every job on App Engine only has 10 seconds to run, and is killed after that time limit is reached, so if you're trying to do something periodically that might take a lot of time to complete (for instance re-indexing) you might have to split this request up into chunks.

...and we're done.

No comments:

Post a Comment