How should I scale my fetch-heavy React/Next.js app?

I have a Next.js app that fetches and processes lots of data for an hour or two every few hours. This spikes the CPU on my Vultr 2-vCPU "high frequency" VPS. The problem is all that fetching from the cron tasks significantly slows down the frontend because of the CPU-spiking. So what is the best way to scale this? I'm considering: 1. Refactor my code so the cron-scheduled fetching happens on a different server, but then I have to create extra API endpoints on both sides for triggering the refreshes and clearing caches. 2. Upgrade my server to get more vCPUs or a VPS with 4 dedicated CPU cores. 3. Something with Kubernetes? Although I don't understand Kubernetes enough to understand how it could handle my scaling when it's the fetching my app does in the background that demands the scaling, not the number of users actively in my app. 4. Something else? Thanks in advance!
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?