Custom Metrics cron job Datastore timeout

41 views
Skip to first unread message

Nikita Sahasrabuddhe

unread,
Jan 12, 2016, 11:52:26 PM1/12/16
to Google App Engine
Hi,

I have written a code to write data to custom metrics cloud monitoring - google app engine.

For that i am storing the data for some amount of time say: 15min into datastore and then a cron job runs and gets the data from there and plots the data on the cloud monitoring dashboard.

Now my problem is : while fetching huge data to plot from the datastore the cron job may timeout. Also i wanted to know what happens when cron job fails ? Also Can it fail if the number of records is high ? if it can, what alternates could we do. Safely how many records cron could process in 10 min timeout duration.

Please let me know if any other info is needed.

Thanks!

Nicholas (Google Cloud Support)

unread,
Jan 13, 2016, 6:09:45 PM1/13/16
to Google App Engine
What happens when cron jobs fail depends on the type of failure. Errors occurring within the module pointed to by the cron job will propagate to the cron job. If the module referred to by the URL of the cron job is unavailable or otherwise unresponsive, I believe a 5xx HTTP response is returned.

Regarding your questions of Datastore records processed during a cron job, this is not connected to cron jobs but rather the module processing those tasks, the speed/size of Datastore retrievals, the concurrency of requests being made, etc. If the cron jobs are outlasting the 10-minute limitation described in the 'Scheduled Tasks' article, you may want to study the performance of the module being used to find some possible optimizations. To help with this analysis, you may want to consider using Cloud Trace. Though in Beta, it can reveal great detail on where your bottleneck can be found.

For instance, bulk operations may be used to consolidate Datastore operations to reduce retrieve more records per request. If this is already being used, you could consider using memcache instead to contain this data temporarily until sent to Cloud Monitoring. The linked Best Practices article can be very helpful in this case showing how to handle checks, sets and batch operations. Otherwise, you may consider configuring the cron job module to scale with more instances or more powerful tiers. An introduction to scaling for App Engine can be found with the article 'How Apps Scale'.

Hope this helps.
Reply all
Reply to author
Forward
0 new messages