I was looking at my usage in Vercel and noticed that I had 83,000+ edge requests in a single day from a single project. I think I might be confused on what “edge requests” actually are. I was under the impression it was anywhere you had runtime = "edge"
. However, that must not be the case as I do not have anything with runtime = "edge"
that is used in my code. Looking at Manage and optimize Edge Network usage, it looks like “Static assets and functions all incur Edge Requests.”. It would be nice to see what functions are actually being called. I didn’t have 83,000+ visitors to my website yesterday and yet, this project shows I had 83,000+ edge requests. More transparency into this so that I can optimize would be great!
Hi, @jamesrsingleton! Thanks for your patience with this
Edge requests on Vercel are not limited to functions explicitly set with runtime = "edge"
. They encompass a broader range of requests handled by Vercel’s Edge Network, this includes:
- Static asset requests (e.g., images, CSS, JavaScript files)
- API routes
- Serverless Functions
- Edge Functions
- Edge Middleware executions
The 83,000+ edge requests you’re seeing could be due to:
- Multiple assets loaded per page view
- API calls made by your application
- Bots or crawlers accessing your site
- CDN caching behavior
To optimize your edge request usage, you could consider:
- Implement caching strategies for static assets
- Optimize API calls to reduce unnecessary requests
- Use Vercel’s Analytics to identify high-traffic pages or endpoints
This generally is a very interesting topic, so I’ll try and get a community post about how to optimise edge requests from the team. Thanks again for highlighting, @jamesrsingleton! Would be keen to hear more about how you’ve been getting on using Vercel
HI @pawlean,
Thanks for taking the time to respond. Yea it would be nice to know better ways to manage this as I went from maybe 600k edge requests to 1.3 million without much change. Not being able to see what is contributing to this huge increase basically just leads me down a rabbit hole which is not ideal. Looking at the “Edge Requests” graph, it seems to be happening on a cycle that I am not able to correlate anything on my end to.
@pawlean any more insight here?
Thanks for your patience, @jamesrsingleton! I’ll circle back with more thoughts shortly.
Thanks because it keeps climbing after I was able to successfully get my requests to about 500k a month.
Hey, @jamesrsingleton! Out of interest, what changes did you make?
None that would impact this to my knowledge. The repo is OSS GitHub - JamesSingleton/redshirt-sports: Website for Redshirt Sports but I don’t know of any changes that would cause this big of a spike.
Hi @pawlean just following up as it has been almost a month and no real help.
Hi, @jamesrsingleton! Apologises for the delay, the community plate has been quite full. Thanks for the friendly ping!
I understand your frustration with the lack of transparency in pinpointing the source of these increased requests. Let me try and break down what’s happening and explore some potential solutions.
Understanding Edge Requests
Edge requests include more than just runtime = "edge"
functions. They cover all requests handled by Vercel’s Edge Network, such as:
- Static assets (JS, CSS, images, fonts)
- API routes (both Edge and Serverless functions)
- Page requests (static and dynamic)
- Middleware executions
- Image optimization requests
Reasons for High Request Counts
It’s common to see edge request counts much higher than visitor counts. A single page visit typically generates multiple edge requests. For example:
- Initial HTML page load
- Multiple JavaScript bundles
- CSS files
- Several images
- API calls from the frontend
- Font files
- Favicon
Your use case
You mentioned an increase from about 600k to 1.3 million edge requests without significant changes on your end. The cyclic nature you’ve observed in the “Edge Requests” graph is intriguing and could point to periodic processes.
Given that you haven’t made significant changes recently, it’s possible that external factors (like increased bot activity or changes in how third-party services interact with your site) could be contributing to this increase. It might be worth setting up some additional monitoring to track the types of requests being made.
A few things to check:
- Check for any recent changes in dependencies or build processes
- Review any scheduled tasks or data fetching operations
- Examine API usage patterns, especially if you’re fetching sports data periodically
Optimization Strategies
- Implement caching strategies for static assets
- Optimize your assets (bundle JS, lazy load images, etc.)
- Minimize unnecessary API calls, especially any that might be happening repeatedly
- Use Vercel’s image optimization features
- Review and optimize any automated processes or background tasks
Monitoring and Debugging
- Use Vercel’s Analytics to identify high-traffic pages or endpoints
- Implement custom logging or monitoring to track different types of requests
- Consider using browser developer tools to analyze network requests on your site
- Add server-side logging for API routes to track their usage
Next steps
- Review your application for any recent changes that might have increased request frequency
- Analyze your deployment logs for any unusual patterns
- Investigate any third-party services or APIs that your application interacts with
Let me know how you get on! I also sent you a DM in case you’d like to share any more specific details outside of a public forum.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.