1

I am trying to move my vf page controller logic to queueable job to over come cpu time out. I am monitoring the queueable job by polling the server from my vf page and then redirecting the user to a record detail page after the job is completed.

But our production environment has lot of jobs scheduled and running.So wondering if queueable jobs are queued until after the rest of the batch apex jobs are completed.

But my analysis in the sandbox shows that all my queueable jobs are completed before batch jobs. even when they are scheduled later.

Appreciate any thoughts on the precedence of the jobs?

1 Answer 1

4

But our production environment has lot of jobs scheduled and running.So wondering if queueable jobs are queued until after the rest of the batch apex jobs are completed.

No.

The system uses heuristics to ensure that all customers get a fair chance at executing their asynchronous processes, and within a single organization, jobs are approached in a sort of round-robin fashion. This answer goes in to a lot of detail about what happens in a lot more detail than I'd care to replicate here, but suffice it to say, Scheduled, future, and Queueable methods take a fair turn with batchable to ensure that everything is processed as soon as possible.

It's possible for later jobs to be executed before earlier jobs when certain conditions are met (unless they are chained together), and it's not possible for one org or one type of process (future, queueable, or batchable) to hog all the available resources. You might say that Batchable classes are deprioritized over other types of jobs, simply because the nature of how they execute.

They have to compete with all the other asynchronous jobs on a per-transaction basis, ensuring that everything runs in a timely manner.

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.