Tuesday, November 2, 2010

Google App Engine and Cron

  1. Stagger your cron tasks such that they don't resonate
  2. Limit cron time limits to 2 digits
Looking at the requests/second graph on my GAE dashboard recently, I noticed a pattern of medium peaks at one frequency and a pattern of large peaks at about half that frequency.  These were the result of the way I had set up my cron tasks.

Self-inflicted usage spikes have to be avoided when you need to live within per minute quotas.  Because of a natural inclination towards time anchors like whole and half hours, multiple cron tasks were often starting up at the same time even though they all had different intervals.  The large spikes were from when they would all start up at the same time.  Oops.

Changed the intervals to ones that didn't overlap so frequently and ran in the the error below: 

Error parsing yaml file:
Unable to assign value 'every 157 minutes' to attribute 'schedule':
schedule 'every 157 minutes' failed to parse: line 1:8 mismatched input u'7' expecting set None

Turns out that 'every n ...' is ok and 'every nn ...' is ok, but 'every nnn ...' is not.

No comments:

Post a Comment