After reading another misinformed criticism of Google’s App Engine platform, I feel compelled to make a suggestion.
Try your performance tests again, but with a simple change.
Add a @conditionalCache decorator that will always serve a cached response unless the request is from a background task or cron job, in which case it forces a refresh.
You could use the memoize decorator I posted earlier in the summer that allows for some extra params to be sent to configure the per-request cache handling, or something more simple.
Then add these two lines where appropriate:
if self.request.get('X-AppEngine-TaskName', False): force_run = True # force cache refreshCron jobs have an ‘X-AppEngine-Cron’ header, but I haven’t included it in this if-statement because your cron jobs should not directly hit the URLs in question, but rather add a task to hit that URL. Then, if the request fails, the task will be retried until it succeeds and can cache the results, whereas the cron job would simply fail.
You can cache your templates this way, or any arbitrary data objects, especially anything that requires a GQL query or URLfetch. Of course, you may have specific elements you don’t want to cache, and you can usually render those at runtime without too much trouble if they don’t involve a db hit.
Cron jobs are very easy to configure, but background tasks are much more versatile and useful. For instance, to refresh popular pages more often, you could use another decorator to launch a background task to force a refresh of the page’s cache after N number of requests to a given URL are made.
September 29, 2009
Why Your ‘App Engine Sucks’ Post Sucks