0

I have a LWC that loads on a frequently accessed lightning page (thousands of times an hour).

It makes a request through synchronous Apex to a legacy webservice where response times are 20 seconds. The rest of the transaction happens within milliseconds.

Concurrent Apex Limits

Considering concurrent Apex request limit is 10 total requests that go over 5 seconds, I would expect many request to denied, but the documentation states:

"HTTP Callout processing time isn't included when calculating the limit".

Does this mean that the 20 seconds it takes to get a response is not counted against the transaction time?

Or does "HTTP Callout processing time" refer to the backend operation time related to the SF platform making a request and receiving a response, excluding the actual response time from the endpoint.

The timeout can be extended to 120ms. From the documentation:

The default timeout is 10 seconds. A custom timeout can be defined for each callout. The minimum is 1 millisecond and the maximum is 120,000 milliseconds. See the examples in the next section for how to set custom timeouts for Web services or HTTP callouts.

Is the upper limit for this so high to accommodate for the low volume use cases where you do not have overlapping long running API callouts?

Concurrent API Limits

Documentation states:

The following table lists the limits for various types of orgs for concurrent inbound requests (calls) with a duration of 20 seconds or longer.

Org Type ||| Limit Developer Edition and Trial orgs ||| 5 Production orgs and Sandboxes ||| 25

The timeout limit for an API call is 600,000 milliseconds (10 minutes).

I'm confused by the use of "inbound requests" and "calls". Are these calls to the Salesforce REST API from an external client or calls from Salesforce to external endpoints?

Reference

https://developer.salesforce.com/docs/atlas.en-us.salesforce_app_limits_cheatsheet.meta/salesforce_app_limits_cheatsheet/salesforce_app_limits_platform_api.htm

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_timeouts.htm

2 Answers 2

2

You're not reading this wrong: only the Apex execution time counts against the concurrent long-running transaction limit. Even if your service took 115 seconds every time, you'd never run into that particular limit. Note, however, that there is a limit to the number of concurrent callouts per org, so with enough traffic, it would be possible for some callouts to be denied, but not because of the concurrent long-running limit.

You can make up to 20 concurrent callouts to endpoints outside of your Salesforce org’s domain. You can make unlimited concurrent callouts to internal endpoints. --documentation

2
  • Is the limit of 20 callouts per apex transaction, per user, or per org at any given time? I would imagine per transaction or per user as I have 8 components loading on a page being accessed by a couple hundred users and would think we would run into that limit quickly if it was org based.
    – S.B.
    Commented Sep 28, 2022 at 17:58
  • 2
    @S.B. It's just 20 per org. It's entirely possible to reach that limit if you have a lot of users at once. You may want to investigate any possible options to use direct client-side fetch or perhaps some kind of cache if that's a concern.
    – sfdcfox
    Commented Sep 28, 2022 at 18:02
1

I couldn't add comment to sfdcfox's comment that's marked as accepted. So adding a separate comment.

Summer 24 documentation says the "20 concurrent callouts to endpoints outside of SF org" is applicable only for Developer edition orgs. There is no such limit for non-dev edition orgs.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_timeouts.htm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .