1

In the org I work in we've been having issues with the concurrent apex limit. For context, specifically this limit.

Number of synchronous concurrent transactions for long-running transactions that last longer than 5 seconds for each org. Default is 10. Some orgs can get the limit increased.

I've pulled down my orgs Apex Execution Event logs and noticed that Apex methods for a test (quiddity -- TD, test ran via deployment) and some other apex transactions whose RUN_TIME are well below 5000 milliseconds are marked as IS_LONG_RUNNING_REQUEST.

The documentation for IS_LONG_RUNNING_REQUEST states transactions marked with this count against the limit.

Anyone else run into this sort of trickery? Do tests really count against this limit? And how is it possible for RUN_TIME to be below 5 seconds yet still count?

Going to raise a case with Salesforce support, but figured I would ask others just incase.

1 Answer 1

2

As the documentation states:

Indicates whether the request is counted against your org’s concurrent long-running Apex request limit (true) or not (false).

This only tells you that the transaction is a synchronous request that counts against the concurrent limit. It does not state that this request was terminated because of the long-running concurrent limit.

For that, you need to correlate the log file associated with that entry to see what happened. Only transactions with IS_LONG_RUNNING_REQUEST set to true and has a RUN_TIME over 5 seconds.

This flag can be used to find events in the log (via filters) to determine events where the run time was more than 5 seconds and counted against the limit. You can then easily see patterns to figure out where requests were denied because of concurrency limits.

Note that tests can be run synchronously or asynchronously. Asynchronous test execution, such as Run All Tests, do not count against the limit, but single tests run synchronously (e.g. the Run Test button in Deveoper Console) do count against the synchronous concurrent request limit.

3
  • I do understand the request was not terminated. There's another event log for that (Concurrent Long-Running Apex Limit Event). I guess tests ran via deployments do count then in that case. Still not sure how to how things with RUN_TIME of 108 milliseconds have IS_LONG_RUNNING_REQUEST set to true. Will have to see what Salesforce says....
    – Zerkz
    Nov 11, 2020 at 1:48
  • @Zerkz Again, the language from the documentation simply states that the transaction is eligible to be counted against the concurrent limit. This is why a transaction fails immediately if the org is at the 10 concurrent limit, even though the transaction in question may or may not be a long running request. Or, stated differently, the transaction is in a context that would be affected by the org-wide limit. This is decided the very millisecond the transaction starts.
    – sfdcfox
    Nov 11, 2020 at 5:14
  • Coming back to add some extra information. After some exchanges with support, we have found out there are numerous untracked things, one being decryption time for encrypted fields, that count against the "5 second" limit. These are NOT counted in RUN_TIME unfortunately (or viewable anywhere else) , so you're kinda in the dark.
    – Zerkz
    Jan 29, 2021 at 7:06

You must log in to answer this question.

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