API – Purpose of Concurrent API Limit

apiArchitecturegovernorlimitsintegration

As per the Salesforce Documentation, the Concurrent API limit is a limit for concurrent inbound requests (calls) with a duration of 20 seconds or longer and it differs based on the org type:

  • Developer Edition and Trial orgs – 5 requests limit
  • Production orgs and Sandboxes – 25 requests limit

Also, as per this Salesforce Documentation, we have Maximum CPU time on the Salesforce servers limit, which differs based on the type of the transaction:

  • Synchronous – 10 seconds
  • Asynchronous – 60 seconds

  1. What is the purpose of the Concurrent API limit and why is it so low
    (strict), given that some Salesforce orgs might receive tens of calls
    from external systems every second?
  2. If the incoming call is Request and Reply, calling e.g. some custom Apex Class that executes a complex logic and waiting for it to finish to receive a response, the transaction throws an exception after 10 seconds, meaning that the call to Salesforce won't be able to get to 25 seconds. If some logic in the Apex Class executes as asynchronous (using Queueable, Batchable or @future annotation), it processes in a different transaction and the result is not returned to the client calling Salesforce, meaning that this would also not be a reason to reach the limit of 25 seconds. What could be the scenarios of reaching the Concurrent API limit?

Best Answer

1. What is the purpose of the Concurrent API limit and why is it so low?

As per the documentation you referenced:

To maintain optimum performance and ensure that the Lightning Platform API is available to all our customers, Salesforce balances transaction loads by imposing ... limits.

So fundamentally this is one of the limits imposed to prevent a given org from blocking the HTTP based API resources from use by other tenants on the same host. There are only so many connections that can be maintained concurrently by the server.

It is low, I suggest, because the pool of connections is relatively small compared with the number of tenants that can be sharing the same server.

Note that this suggests you write your custom REST API code to avoid long-running actions.

2. The transaction throws an exception after 10 seconds, meaning that the call to Salesforce won't be able to get to 25 seconds?

There are other operations in a transaction that take time but that do not contribute to CPU limits. Two such examples are:

  • SOQL query time (these can take a long time if you have poorly optimized queries or large data volumes without appropriate custom indexes or skinny tables).
  • Time spent waiting for callouts to complete.
Related Topic