Understand Functions Limits

Salesforce Functions code runs "outside" of your org in an elastic compute environment and has separate limits. This article lists Salesforce Functions limits and identifies other Salesforce limits that apply to your functions.

For more information on working within Salesforce Functions limits, see Functions Patterns and Best Practices.

Some limits apply per Salesforce Functions license regardless of invocation type.

Total requests from your functions to your org per 24-hour period235,000 requestsYour invoked functions can make up to 235,000 requests total (across all functions) to your org per license per 24 hours. Functions request allocations are separate from standard org core API limits: only Salesforce Functions can use these 235,000 requests, but Salesforce Functions can't access standard core API limits. After the 235,000 request limit is reached, requests will start failing. Methods called from your function with a Salesforce Functions SDK are considered requests.
Total function execution time per month1 million GB-secondsYour invoked functions can only run for a total of 1 million GB-seconds per month per license. This limit is distributed across all orgs that are using Salesforce Functions. After this limit is reached, functions will continue to run and you'll be charged for any overages.

Functions can be invoked by Apex either synchronously or asynchronously. Some Salesforce Functions limits change depending on the invocation method.

Previously, asynchronously invoked functions didn't enforce a 15-minute timeout. This limit is now enforced and functions running longer than 15 minutes return an error to Apex.

Function run time15 minutesAsynchronously invoked functions run for 15 minutes before timeout.
Payload size12 MBAn asynchronously invoked function can accept a payload up to 12 MB.
Response size12 MBAn asynchronously invoked function can send a response no larger than 12 MB.
Simultaneous function invocationsno limitThere's no limit on how many times a function can be invoked asynchronously.
Function run time2 minutesSynchronously invoked functions run for 2 minutes before timeout.
Payload size6 MBA synchronously invoked function can accept a payload up to 6 MB.
Response size6 MBA synchronously invoked function can send a response no larger than 6 MB.
Simultaneous function invocations10 long-running functionsYou can only invoke 10 long-running (>5 seconds) functions at a time when invoking synchronously.

After a timeout, function code continues to run and can communicate back with the org. The timed out function can insert records, thus generating CDC events, or even send Platform Events itself. This behavior will change in the future when the timeout is enforced by providing a means to terminate long running invocations.

Salesforce Functions uses containers to handle invocations. Salesforce Functions automatically increases or decreases the number of function containers available to handle invocations based on CPU load and memory usage. Each function container can handle multiple concurrent invocations. As a result, the total available memory in a function container is shared across all concurrent invocations. Both synchronous and asynchronous invocations have process memory for each function container.

Invocations from multiple environments and the same org run concurrently. Invocations from separate orgs run in separate containers and contribute to separate limits.

The platform shuts down the container and starts a new one when the total memory footprint exceeds the container's limit at approximately 1 GB. Concurrently running invocations and other overhead contribute to the process memory limit in the function container. When the limit is reached, currently executing invocations in that container fail and an Out of Memory message is logged in the function log stream.

The following limits aren't specific to Salesforce Functions but relevant to your functions and Apex code.

  • Apex Governor Limits: These limits apply to all Apex code, including code that invokes Salesforce Functions. These limits prevent your code from using resources inefficiently.
  • API Request Limits: These limits include concurrent API requests, API timeout limits, and total API request allocations.
  • Composite Graph API Limits: Functions use the Composite Graph API when making requests using the UnitOfWork class from a Salesforce Functions SDK. Functions that use UnitOfWork are subject to Composite Graph API limits.

See Functions Patterns and Best Practices for guidance on working within limits.