Edge request usage is climbing and I don't know why

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.

1 Like