Limits
To ensure fair usage and optimal performance across users, the following execution limits are enforced:
Feature | Limit | Description |
---|---|---|
CPU Time per request | 30s | Maximum CPU time allocated per request. |
Active memory | 128 MB | Maximum memory available to isolate instance. |
Subrequests | 50 | Number of subrequests a script can make per request. |
Script size | 10 MB | Maximum size of the script code. |
Startup time | 500ms | Maximum time to startup the script. |
Environment variables per Script | 128 | Maximum number of environment variables per script. |
Environment variable size | 2KB | Maximum size of environment variable value. |
The limits are designed to accommodate typical use cases under normal operating conditions and provide a fair execution environment for all users.
Edge Scripting environments have built-in flexibility to handle occasional spikes that exceed these limits. However, if a script consistently hits or exceeds these limits, it will be subject to termination or other throttling measures to maintain system stability and performance.
Best Practices for Managing Limits
- Optimize Script Performance: Regularly review and optimize your script's code to ensure it executes within the time and memory limits.
- Manage Subrequests Efficiently: Design your scripts to minimize the number of subrequests. Cache responses whenever possible to reduce load and improve response times.
- Monitor and Log: Utilize logging and monitoring tools to track your script's performance and resource usage. This can help in identifying potential issues before they lead to limit violations.
CPU Time
CPU time is measured when script actually uses CPU to execute script logic. It directly affects how quickly a script can respond to requests. It is allocated per request, ensuring that each script execution has a fair amount of processing time.
The platform is designed to be forgiving for infrequent spikes in CPU usage; however, consistent exceedance will lead to script termination. This enforcement helps maintain the health of the system and ensures fair resource allocation across all scripts running on the platform.
Updated about 2 months ago