How to Reduce Edge Requests on a Client-Side App Deployed with Vercel?

0
2
Asked By CreativeCoder92 On

I woke up to an email from Vercel saying I've hit 75% of my Edge Requests limit for my free account. My project, a client-side PDF tool at local-pdf-five.vercel.app, has been gaining traction, but now I'm worried about the costs. The app is built with Next.js App Router and lets users merge, compress, and redact PDFs directly in the browser. My suspicion is that the Next.js setup is causing too many prefetch requests when users visit the homepage. I'm looking for advice on how to manage this—specifically: 1) Can I throttle the prefetching without sacrificing load speed? 2) Does Vercel's Image Optimization contribute to the Edge Requests? 3) Should I consider moving to Cloudflare Pages or a VPS if traffic continues to rise? Any help would be appreciated before my project faces a suspension!

1 Answer

Answered By TechSavvySteve On

It sounds like the prefetching is definitely a big part of the problem. With your dashboard having many tools, it’s likely that Vercel is fetching route assets for every visible link on the page load, leading to excess requests even if users don’t click all those links. A common fix is to enable prefetching only when users hover over a link instead of automatically on page load. This should reduce unnecessary requests and keep the instant feel when they do click. Also, consider caching those prefetches to avoid fetching them multiple times.

NerdyNate -

Totally agree! Caching for prefetch requests could save a lot. Also, check for anything in your app that's constantly polling, as that can quickly eat up your requests.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.