How-to
2 min read
Configuring Memory for Vercel Functions
Learn how to set the memory of a Vercel Function.The memory configuration of a function determines how much memory the function can use while executing. This guide will walk you through configuring the memory for your Vercel Functions.
Functions using the Edge Runtime can't be configured with custom memory settings. This helps ensure minimal cold starts in their limited execution environment.
For other runtimes, you can configure the memory up to the allowed limits for your plan:
- Use the
functions
property within yourvercel.json
- Use a glob pattern to specify the path
- Specify an integer defining the
memory
in MB for your Serverless Function (between 128 and 3008)
The order in which you specify file patterns is important. For more information, see Glob pattern.
vercel.json
{
"functions": {
"api/test.js": {
"memory": 3008
},
"api/*.js": {
"memory": 3008,
"maxDuration": 30
}
}
}
To learn more about the maximum size of your function's memory, see Max memory size.
Last updated on December 1, 2023
Was this helpful?