Environment and rate limits
This article provides information on the functions execution environment, rate limits, and execution limits.
Functions have the following limitations:
- Functions cannot use third-party libraries.
- Functions have 32 MB of memory.
If a function attempts to use more than 32 MB, the following error is written to the log:
Exception 400 BAD REQUEST - OutOfMemoryError: memory limit 32 mb is exceeded.
Rate limits for data transformation functions
Data transformation functions have the following execution limits:
- 1 hour of execution time per minute OR
- 250,000 invocations per minute (15 mm per hour)
These execution limits are based on the account and the region. The sum of the execution time and the number of invocations for all functions in an account for a region cannot exceed these limits.
If either limit is exceeded, function execution is briefly stopped (throttled). The following message is displayed in the Functions Overview and a yellow alert icon is displayed next to a throttled function, as follows:
For information on how to view details for throttled functions, see View function statistics.
Execution time limits for event and visitor functions
Event and visitor functions have the following execution limits:
- Execution rate: 180,000 events per minute
- Execution time: 8 hours per minute
- Execution time for each function invocation: 10 seconds
If a function exceeds the 10 seconds execution time, the following error is written to the log:
Exception 504 - Invocation timeout limit exceeded.
Execution rate and execution time: example 1
In this example, we assume that function that communicates with external APIs takes about 100 ms per invocation. In addition, we assume there is only one function configured for the account and the average execution rate of this function is 1000 invocations per second.
The execution rate and execution time within a 1-minute time window are as follows:
Events per second = 1000 * 60 * 1 min = execution rate of 60,000 invocations per minute
Execution time = 1000 invocations/second * 100 ms / 1000 = 100 minutes = 1.66 hours execution time per minute
In this case, the execution rate and execution time are both below the limits.
Execution rate and execution time: example 2
In this example, we assume that external API performance temporarily degrades, and the function execution time is 800 ms per invocation. That means that our execution time is increased by 8.
Execution time = (1000 inv/s * 100 ms / 1000) * 8 = 800 minutes = 13.28 hours of execution time per minute.
The execution time in this case is 13.28 hours per minute, which is greater than 8 hours/minute maximum. Function invocations may be throttled.
Thank you for your feedback!
This page was last updated: February 21, 2023