+ Start a Discussion

How to make Apex Batches execute parallelly while processing large volume of data?

Hi, we have a requirement to process large data which is around 300,000 Records. I am planning to implement it using Apex Batches with each batch size being 50.

In Apex Batch i will have to store these 50 records in a single string after concatenation for further procesing.As String size is limited by heap size i will not be able to process more than 50 records in each batch

We will not be able to increase each batch size due to lmits on String size( heap size) and other governer limits. That makes around 4000 batches being created.

Is there a way to make Apex batches execute parallelly so that to improve the performce of the program?


You can't execute batch parallely however you can serialize it. To serialize the batch, You need to call the batch in finish method.
For more about batch class, check out my blog : http://salesforce-atom.blogspot.in/2014/01/salesforce-batch-apex-for-beginners.html
Happy Coding!!