Sub topic 1
Why Salesforce Has Limits
Salesforce is a multitenant platform. A multitenant platform runs many customer organizations on shared infrastructure. Limits prevent one organization or integration from consuming resources needed by others. They also make performance more predictable.
Prerequisites
Assume you know what a Salesforce org, API request, and Apex transaction are. You should also be comfortable reading HTTP responses and basic Apex.
The main kinds of limits
Salesforce limits apply to different resources and time scopes:
| Limit category | Scope | Example |
|---|---|---|
| Daily API limits | Org over a rolling 24-hour period | REST, SOAP, Bulk API, and other API calls |
| Concurrent request limits | Org at one time | Long-running API requests |
| Governor limits | One Apex transaction | SOQL queries, DML statements, CPU time, and heap |
A limit in one category does not necessarily mean that another category is exhausted. For example, an org can have daily API requests remaining while too many long-running requests are active.
The daily API request limit
The daily API request limit counts API calls made by an org during a rolling 24-hour window. The maximum depends on factors such as the org edition, licenses, and purchased capacity. One request can return many records, so request count is different from record count.
You can query current usage through the REST Limits resource:
curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
"$INSTANCE_URL/services/data/v60.0/limits"The response includes values such as Max and Remaining for DailyApiRequests. API responses can also include a Sforce-Limit-Info header, such as api-usage=25/15000. Record the remaining value and alert before usage reaches the maximum.
Concurrent long-running requests
Concurrent limits protect shared server capacity. Salesforce tracks requests that run longer than the platform’s long-running threshold. A burst of slow reports, poorly filtered queries, or overloaded integrations can reach this limit even when the daily allowance is healthy.
Reduce concurrency by limiting parallel workers, selecting only needed fields, filtering queries, and using asynchronous or bulk interfaces where appropriate. Retry only after a delay. Immediate retries can keep the request pool full.
Exercise
An integration has many daily API requests remaining but receives a concurrent-request error. What should you investigate first?
Show answer
Investigate slow active requests and excessive parallelism, then reduce worker concurrency and improve request performance.