Next.js Discord

Discord Forum

Content download timing is 5s

Unanswered
Cuvier’s Dwarf Caiman posted this in #help-forum
Open in Discord
Cuvier’s Dwarf CaimanOP
Hello guys, I've faced some unknown issue. Content download timing is 4s+ even page has no blank. It happens when route change. Why this is happening, how to fix it? #pageloading, #performance

1 Reply

Acacia-ants
Hello leroy. There can be a lot of reasons for this to happen. First things first, are you running the server with next dev or next start? Development servers are slower than the production one for starters, on top of that your computer might be slow or you might have a lot of running programs (hardware issue). Try repeating your tests on production server. If the issue is caused by hardware issue (and it's probably not, not entirely at least) I suggest you start debugging.
1. You can with analyzing your bundle - https://nextjs.org/docs/app/building-your-application/optimizing/bundle-analyzer. With bundle analyzer it should be easy for you to spot big chunks of code that can hurt the performance of your application and find a way to remove them or reduce their size;
2. Then you can test how much time it takes for the API calls to resolve (the issue might be in the BE not in the FE). You can use various techniques to optimize that but I would suggest you start by parallelizing your queries.

I'll stop here. If you want you can try these 2 things and let me know what the outcome is and then we can continue with other optimizations.