# Function memory, timeout and limits
Source: https://sovaria.in/docs/functions-limits

Give each function its memory, timeout and minimum warm instances, and know the limits every function shares: invocations, compute, concurrency, cron schedules, triggers, retries, outbound hosts and logs.

Every run of an edge function gets a slice of memory and a time budget. You choose both per function, within your plan; the limits below the form are shared by every function in the organization.

(Diagram: What limits one function run)

## Memory and timeout

Functions › Events & logs › **Memory & timeout**: pick a function and set **Memory** (MB) and **Timeout** (seconds). Empty means your plan’s maximum. The next run uses the new values.

- Compute is billed in GB-seconds (memory × run time), so less memory costs less.
- A run past its timeout is stopped and logged as `TIMEOUT`.
- A value above the plan’s maximum is refused with `PLAN_LIMIT_REACHED`; the line under each field shows the next plan’s value.

| Field | What to enter | Tip |
|---|---|---|
| Memory | MB for each run (64 up to the plan maximum). Empty = 512 MB, or the plan maximum if lower. | Start at 256 MB; raise it if the logs show `out of memory` or slow JSON handling. |
| Timeout | Seconds a run may last (1 up to the plan maximum). Empty = 30 seconds, or the plan maximum if lower. | Keep HTTP functions short (users wait); give cron and trigger functions more, up to the plan maximum. |

Example: a 512 MB function that runs 300 ms uses 0.5 GB × 0.3 s = **0.15 GB-seconds** per call; a million calls use 150,000 GB-seconds.

|  | Free | Pro | Ultra | Team | Enterprise |
|---|---|---|---|---|---|
| Function memory | 256 MB | 1 GB | 2 GB | 4 GB | 4 GB |
| Function timeouts | 10 s | 1 min | 5 min | 15 min | 15 min |

## Minimum instances (no cold start)

Every call runs in a fresh, single-use sandbox. Starting one takes about 0.4 s (a **cold start**); Sovaria keeps a few started ahead of time, so most calls start **warm** — tens of milliseconds ([Benchmarks](https://sovaria.in/docs/benchmarks#functions)). In a burst those can run out. **Minimum instances** keeps that many sandboxes started for one function only, so its calls start warm whatever else is running.

- Set it next to memory and timeout (**Minimum instances**), with `sov fn limits <name> --min-instances 2`, or `setFunctionLimits({ functionName, minInstances: 2 })`.
- The sandboxes are the same isolated ones every call gets: none holds your code or secrets before a call arrives. A Python function's sandbox may be kept for the next calls of the same version ([Local development, logs and streaming](https://sovaria.in/docs/functions-local-development#cold-starts)); it is never shared with another function, version or project.
- They are kept while the function is used, and released after a day without calls (the next call brings them back).
- Best for user-facing functions that see bursts (checkout, sign-up hooks). It costs nothing extra on your bill; the plan sets how many.

|  | Free | Pro | Ultra | Team | Enterprise |
|---|---|---|---|---|---|
| Minimum warm instances per function | — | 1 | 2 | 4 | 8 |

## Limits every function shares

Invocations and compute are monthly allowances: Free stops at them, paid plans are billed beyond. The rest are ceilings.

|  | Free | Pro | Ultra | Team | Enterprise |
|---|---|---|---|---|---|
| Monthly function invocations | 100,000 | 1,000,000 | 3,000,000 | 20,000,000 | 100,000,000 |
| Monthly function compute (GB-seconds) | 5,000 | 50,000 | 200,000 | 1,000,000 | 5,000,000 |
| Concurrent function invocations | 5 | 50 | 200 | 500 | 2,000 |
| Scheduled cron jobs | 2 | 25 | 100 | 500 | 2,000 |
| Function event triggers per project | 2 | 25 | 100 | 250 | 1,000 |
| Tries per trigger event before it is dead-lettered | 3 | 8 | 10 | 12 | 15 |
| Days dead-lettered trigger events are kept | 1 day | 7 days | 14 days | 30 days | 30 days |
| Allowed outbound hosts per function | 3 | 25 | 50 | 100 | 500 |
| Environment variables per function | 20 | 200 | 500 | 1,000 | 2,000 |
| Function log retention (hours) | 1 h | 7 days | 14 days | 28 days | 90 days |
| Bundling your own function dependencies | — | ✓ | ✓ | ✓ | ✓ |

## Tips

- Retries and dead letters belong to event triggers — see [Event triggers](https://sovaria.in/docs/function-triggers).
- Outbound hosts must be listed per function; requests to others are refused by the egress proxy.
- Logs older than your plan’s retention are deleted; stream them elsewhere with [Logs and log drains](https://sovaria.in/docs/logs-and-log-drains).
