Function settings
Memory, maximum duration, keep warm, worker caps and IAM roles: what each setting does, where to set it, and what it costs.
The settings
| Setting | Default | Range | Applies |
|---|---|---|---|
| Memory | 640 MB | 128 to 10,240 MB | Next deploy or redeploy |
| Max duration | 300 seconds | 1 to 900 seconds | Next deploy or redeploy |
| Concurrent compute | On | On or off | Next deploy or redeploy |
| Max requests per instance | 10 | 2 to 50 on each worker | Within seconds |
| Keep warm | Off | 0 to 20 environments per region, or automatic | Within seconds |
| Max workers | No cap | 1 to 1,000 per deployment | Within seconds |
| Regions | Your install’s region | Any of 20 AWS regions | Next deploy or redeploy |
Change them under the project’s Settings → Functions, or from the CLI:
forkrail project my-api # show the settingsforkrail project my-api --memory 1024 --max-duration 60 # 'default' clears oneforkrail project my-api --concurrent false # one request per workerforkrail project my-api --keep-warm 2 # or auto, or 0Which value wins
For memory, max duration and concurrent compute, the first of these that sets a value wins:
- The deploy’s own flag:
forkrail deploy --memory 1024(that deployment only; a redeploy doesn’t keep it). - The deployment’s
vercel.json:functionspatterns andfluid. - The project’s settings.
- forkrail’s defaults: 640 MB, 300 seconds, concurrent compute on.
{ "functions": { "api/**/*.py": { "memory": 1024, "maxDuration": 60 }, "api/report.ts": { "maxDuration": 300 } }}All of a deployment’s functions run in one Lambda function, which gets the largest memory any of them asks for. Each still keeps its own maxDuration, which the router enforces per request.
Memory and CPU
Memory also buys CPU: Lambda gives a full core at 1,769 MB and a proportional share below that. Lambda bills by memory × time, so the right size depends on what your function spends its time doing.
- Mostly waiting on a database or other APIs: small is fine. Such an API runs about as fast at 256 MB as at 640 MB, for 40% of the price.
- CPU-heavy, like server-side rendering or image work: more memory finishes sooner. 1,024 MB buys 0.58 of a core where 640 MB buys 0.36.
- Cold starts don’t get slower at small sizes.
Some new accounts can give a function only 512 MB at first. forkrail sizes every function to fit, the deployment’s log says so, and the dashboard shows the limit under Infrastructure and in Settings → Functions. AWS raises it as the account is used, or sooner through a free support case.
Max duration
A request that runs longer than its function’s maxDuration gets 504 FUNCTION_INVOCATION_TIMEOUT and its stream is cut. The ceiling is 900 seconds (15 minutes), Lambda’s own. Responses stream as they’re written, so a long response starts reaching the visitor right away.
Need to keep working after the response? waitUntil() from @vercel/functions keeps the worker open until the promise settles, as on Vercel.
Keep warm
Lambda drops an environment after a few idle minutes, and the next request waits for a new one to start (a second or more for a framework’s server). Keep warm has the routers keep a number of environments ready for the project’s production deployment, in every region it runs in, so a request after a quiet spell doesn’t wait.
forkrail project my-app --keep-warm 2 # two environments per regionforkrail project my-app --keep-warm auto # as many as were busy at once at the last day's peakforkrail project my-app --keep-warm 0 # off (the default)- The router sends a keep-alive every 2 minutes, which never reaches your app. Real traffic counts in its place.
- It costs about $0.011 a month per environment at 1 GB, shown in the dashboard as you choose.
- A deployment with no visitors for 7 days is paused until its next request.
- Separately from keep warm, every new production deployment is warmed before it goes live.
Workers and AWS concurrency
A deployment may run as many workers as your AWS account’s Lambda concurrency allows, shared with everything else in the account. What counts is requests in flight: 100 requests a second at 1 to 2 seconds each is 100 to 200 at once (fewer workers with concurrent compute). Past the account’s limit, requests wait up to 15 seconds for a worker, then get 503.
Cap one project so it can’t take the whole account:
forkrail limits my-api --max-workers 300 # applies within seconds, no redeployforkrail limits my-api # show itforkrail limits my-api --max-workers defaultThe dashboard’s Infrastructure page shows how many functions can run at once in each region. Raise the account’s limit in AWS Service Quotas (Lambda → Concurrent executions).
Calling AWS from your app
On Vercel you’d put access keys in environment variables. Your forkrail app already runs in your AWS account, so give its project an IAM role instead, and the AWS SDK picks it up with no keys at all:
forkrail project my-app --role my-app-role # by name or ARN; needs the install's AWS credentialsforkrail project my-app --role default # back to the shared forkrail-worker roleThe role applies from the next deploy. It’s the way to reach S3, DynamoDB, SQS, Bedrock or RDS from your app, and replaces Vercel’s OIDC federation.
Request limits
- Request bodies up to about 4.5 MB, as on Vercel. Larger ones get
413 FUNCTION_PAYLOAD_TOO_LARGEbefore any function runs. Responses have no size limit: they stream. - Headers: one header over 32 KB gets
494; more than 500 headers, or about 127.5 KB in all, gets431. - Loops: when calls between your own deployments nest more than 5 deep, or one chain makes more than 1,000 such calls, the next gets
508 INFINITE_LOOP_DETECTED. A page calling its own API is never affected.
See Limits and Error codes for the full lists.