Below are some important considerations to bear in mind when utilizing batch Apex:
Concurrent Job Limitation:
The maximum number of batch jobs that can be queued or active simultaneously is 5.
Flex Queue Capacity:
The Apex flex queue can accommodate up to 100 batch jobs in a holding state.
Test Execution Limit:
During a running test, a maximum of 5 batch jobs can be submitted.
Method Execution Threshold:
Within a 24-hour period, the total number of batch Apex method executions is capped at 250,000.
However, if the product of the number of user licenses in your organization and 200 exceeds 250,000, then that becomes the limit.
This includes the start, execute, and finish methods of batch Apex, along with other asynchronous Apex features such as Queueable Apex, scheduled Apex, and future methods.
To check the available asynchronous Apex executions, you can make a request to the REST API limits resource.
License Types Considered:
The method execution limit encompasses full Salesforce and Salesforce Platform user licenses, App Subscription user licenses, Chatter Only users, Identity users, and Company Communities users.
QueryLocator Limitation:
The maximum number of records that the Database.QueryLocator object can handle is 50 million.
If the number of returned records exceeds 50 million, the batch job will fail.
Scope Parameter Constraint:
If the start method returns a QueryLocator, the scope parameter of Database.executeBatch can have a maximum value of 2,000.
If set to a higher value, Salesforce will divide the records into smaller batches.
When the start method returns an iterable, there is no upper limit on the scope parameter, although using a high number may have other limitations.
An optimal scope size is typically a multiple of 2,000.
Default Scope Size:
If the scope parameter is not explicitly specified, Salesforce will divide the records into batches of 200.
Apex governor limits are reset for each execution of the execute method.
Callouts:
Each of the start, execute, and finish methods can implement a maximum of 100 callouts.
Start Method Limitation:
Only one batch Apex job's start method can run at a time in an organization.
Jobs that have not started yet remain in the queue until they are initiated.
However, the execute methods of multiple batch Apex jobs can run in parallel.
FOR UPDATE Constraint:
The use of the FOR UPDATE clause in SOQL queries to lock records during update is not applicable to Batch Apex.
Cursor Availability:
Cursors and related query results remain accessible for 2 days, including results in nested queries.
Comments
Post a Comment
Please Write your comment here.