In my sandbox environment, I have a batch job that invokes itself when it's done - it watches for records in a "actions" table, and executes them, so when the table is empty, it basically does no work. Normally, this batch job 20-30 times a minute, but in the last few days, it's closer to once a minute, and has a 5-10 minute delay a time or two an hour. Usually, when one execution of the job scheduled another, it'd go to 'Queued' quickly, but in the last few days, it spends a while in 'Holding' first.
Is this delay in processing batch jobs just an indication that the Salesforce platform is overloaded and jobs from my sandbox are de-prioritized? A misconfiguration in my sandbox? Is there a way I can see something from Salesforce to indicate why these jobs are running so much more slowly?
If this is just a temporary-overload issue, I can live with it, but I'm worried that there's a fundamental issue with this approach and I may need to look at other options, as in production, I'd like this job to be firing frequently enough that I can process many actions a minute (I can only process one action per batch, as I need almost all of the DML limit since I have to upsert many tables).
Edit: Further investigation indicated some of our jobs would take 5-10 minutes between CreatedDate
and CompletedDate
in ApexAsyncJob
during the time we saw few jobs executed, even though the processed 0 records.