0

How Apex jobs runs in salesforce.

Suppose i have 11 users and if they submit batch class to run how salesforce accept there request. If they are submitted at same time and how salesforce maintain queue.

Salesforce can have more then 5 jobs in process+queue+preparing????

2
2

Batches can't be queuing (querying for records and getting the query locator ready and whatever else is in there start portion) at the same time.

So in your example, the first request in will queue, and then start it's execute method, and the the next batch in line will start its start method.

They can all be processing concurrently, but only one start method can go at a time.

They become an async job with a status. You can see apex jobs and their start time and status in the setup part of salesforce.

And yes, the first 5 in will run, everyone else will get a limits error.

2
  • So this means that there will be never any possibility that more than 5 apex jobs run ie 5 run and 1 in queue so total 6 jobs. – Bhaskar Arora Apr 2 '14 at 10:23
  • 1
    No, I think 5 in queue or executing is the limit. The "6th person in line" will receive a limits error. If you're needing to do a lot of batch stuff, and prevent this kind of issue, there are ways to that--most people end up with a single batch job that's built to process a wide variety of things. Then it just runs constantly as an endless loop, and you just put items in its queue. It's a fun pattern, and helps with so many apex gov limit issues. – Shane McLaughlin Apr 3 '14 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.