Reference
Manage and optimize usage for Edge Middleware
Learn how to understand the different charts in the Vercel dashboard, how usage relates to billing, and how to optimize your usage for Edge Middleware.Table of Contents
Next.js (/app)
Edge Middleware is priced based on the number of times your middleware is invoked. This page explains how to manage and optimize your usage for Edge Middleware.
Select a Region
You are charged based on the number of times your Middleware get invoked.
When viewing your Invocations graph, you can group by Count to see the total of all invocations across your team's projects.
- Use the Projects option to see the total number of invocations for each project within your team. This can help you identify which projects are using the most invocations happen and where you can optimize
- By default, Middleware is invoked for every route in your project. You should take advantage of the config
matcher
property to limit the routes where your Middleware is invoked. This can help reduce the number of invocations and optimize your usage. See Config object for more information
This is the time your Middleware has spent computing responses to requests. The compute time refers to the actual net CPU time used, not the execution time. Operations such as network access do not count towards the CPU time.
You can view CPU time in two ways:
- Average - This shows the average time for computation across all projects using Middleware within your team. You can hover over the line to see an average for each project on any chosen day. The fair use guidelines denote an average CPU time limit of 50ms/invocation within a one hour period across all your team's projects
- Project - This shows the total time each project using Middleware within your team has spent computing responses to requests
- Group by Projects to see the total amount of CPU time for each project within your team. This can help you identify which projects are using the most CPU time and where you can optimize
- While not directly related to CPU time, you should avoid using
fetch()
in Middleware as it will slow down the Time To First Byte (TTFB) for all requests using the Middleware
Last updated on July 24, 2024
Was this helpful?