Friday 24 July 2009

Batch Apex processing

One of the more interesting feature additions to Salesforce and Force.com had a somewhat muted announcement, slipping out on a blog post on the Force.com blog. The comments on the post show there's a fair amount of interest in such functionality.

And rightly so, as batch Apex processing fills a gap that has required kludges to work around until now.

For those that haven't heard of this feature, it allows Apex code to be run asynchronously over large datasets (it still needs to be clarified if it is 5 million or 50 million). You could look over millions of records and produce statistics for reporting purposes; you could look over records and perform actions on a set of them that are not possible through current functionality. It should mean that any time you want Apex logic to apply to massive (by Salesforce standards) amounts of records, governor limits needn't stand in your way.

However, there are currently two limitations: firstly, though the blog post calls batch Apex one of the "new goodies in Summer '09", it was only released on a limited developer preview - if you've not signed up by now, you'll have to wait for the preview to be extended or for the general release. (Of course, if you're a large enough Salesforce customer, you could always try pestering your account exec...)

The second limitation is that batch jobs can't be scheduled to run, and it's not planned to do so in the initial release. It's on the roadmap apparently, but that's all that's been said so far. If the announcement of this initial functionality is anything to go by, we may not know until it's almost upon us. The comments on the afore-linked blog post contain ideas as to how to work around this for now.

Should you use this new functionality once it's released, even if the lack of scheduling is a pain? My answer would be yes if you can make do with a workaround for now, especially if you're creating new batch jobs for your org. It may be a hassle in the short to medium term but at some point down the line you'll (hopefully) be able to add a schedule relatively easily.

For those currently using workarounds that they'd like to get rid of with batch Apex (e.g. using a batch job on one of your own servers to run Data Loader to extract records and upload them back in just to cause something server side to kick off), consider the workarounds available, and if they can work for you, dip your toe in the water - port some of what you currently do to batch Apex and see how it works for you.

And don't forget to leave a message with how you get on - especially those of you taking part in the developer preview.

No comments:

Post a Comment