Documentation Index
Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
Use this file to discover all available pages before exploring further.
Edge Compute enforces resource limits to ensure fair usage and platform stability.
Execution Limits
| Limit | Default | Maximum |
|---|
| Request timeout | 30 seconds | 60 seconds |
| CPU time per request | 30 seconds | 60 seconds |
| Memory per container | 256 MB | 512 MB |
| Request body size | 10 MB | 10 MB |
| Response body size | 10 MB | 10 MB |
Request Timeout
Functions must return a response within the timeout period. If exceeded, the request is terminated and returns a 504 Gateway Timeout.
# Handle long operations gracefully
import signal
def handler(request):
# Set internal timeout shorter than platform limit
signal.alarm(25) # 25 seconds, leaving buffer
try:
result = long_running_operation()
signal.alarm(0) # Cancel alarm
return result
except TimeoutError:
return {"error": "Operation timed out"}
Memory
Each container has a fixed memory allocation. If your function exceeds memory limits, the container is terminated and a new one starts for subsequent requests.
Tips for memory efficiency:
- Stream large files instead of loading into memory
- Use generators for large datasets
- Clean up resources after use
- Avoid global caches that grow unbounded
# Bad — loads entire file into memory
def bad_handler(request):
data = large_file.read() # May exceed memory
return process(data)
# Good — streams the file
def good_handler(request):
for chunk in stream_file():
yield process_chunk(chunk)
Function Limits
| Limit | Value |
|---|
| Function code size | 50 MB (compressed) |
| Environment variables per function | 64 |
| Environment variable name size | 256 bytes |
| Environment variable value size | 5 KB |
| Secrets per organization | 100 |
| Secret value size | 10 KB |
Code Size
The 50 MB limit includes your code and all dependencies (after compression). Most functions are well under this limit.
If you’re hitting size limits:
- Remove unused dependencies
- Use lighter alternatives (e.g.,
httpx instead of requests + urllib3)
- Exclude development dependencies from production builds
- Consider splitting into multiple functions
Network Limits
| Limit | Value |
|---|
| Outbound connections per request | 100 |
| Outbound request timeout | 30 seconds (configurable) |
| DNS resolution timeout | 5 seconds |
Outbound Connections
Each invocation can make up to 100 outbound network connections. This includes:
- HTTP/HTTPS requests
- Database connections
- TCP sockets
Connection pooling recommended:
# Initialize connection pool globally (once per container)
import httpx
client = httpx.Client(
timeout=10.0,
limits=httpx.Limits(max_connections=20)
)
def handler(request):
# Reuse the pooled connection
response = client.get('https://api.example.com/data')
return response.json()
Rate Limits
| Limit | Value |
|---|
| Deployments per hour | 60 |
| API requests per minute | 1,000 |
| Concurrent function invocations | No hard limit (auto-scales) |
Deployment Limits
You can deploy up to 60 times per hour per organization. This is rarely hit in normal development.
Invocation Scaling
There’s no hard limit on concurrent invocations — the platform auto-scales to handle traffic. However, each new container incurs a cold start, so extremely spiky traffic may see increased latency.
Account Limits
| Limit | Value |
|---|
| Functions per organization | 100 |
| Total function invocations | Based on plan |
| Total CPU time | Based on plan |
Storage Limits (Coming Soon)
These limits apply to upcoming storage features:
KV Storage
| Limit | Value |
|---|
| Key size | 512 bytes |
| Value size | 25 MB |
| Keys per namespace | 1 billion |
| Namespaces per organization | 100 |
| Read operations per second | 10,000 |
| Write operations per second | 1,000 |
SQL Database
| Limit | Value |
|---|
| Database size | 10 GB |
| Databases per organization | 10 |
| Rows per table | No hard limit |
| Query timeout | 30 seconds |
Error Handling
When limits are exceeded, the platform returns specific error codes:
| Error | Code | Meaning |
|---|
| Request Timeout | 504 | Function didn’t respond in time |
| Memory Exceeded | 500 | Container terminated due to memory |
| Payload Too Large | 413 | Request/response body exceeded limit |
| Rate Limited | 429 | Too many requests or deployments |
Example error response:
{
"error": {
"code": "timeout_exceeded",
"message": "Function execution exceeded 30 second timeout",
"request_id": "req_abc123"
}
}
Best Practices
Stay Within Limits
- Set conservative timeouts — Use 25 seconds internally when the platform limit is 30
- Monitor memory — Log memory usage during development
- Stream large data — Avoid buffering entire files
- Use connection pools — Reuse HTTP/database connections
Handle Limit Errors
import httpx
def handler(request):
try:
# Set explicit timeout shorter than platform limit
response = httpx.get(
'https://api.example.com/data',
timeout=25.0
)
return response.json()
except httpx.TimeoutException:
return {
"error": "Upstream API timed out",
"status": 504
}
except httpx.HTTPError as e:
return {
"error": f"Request failed: {e}",
"status": 502
}
Next Steps