javascriptnode.jsexpresspageloadpage-load-time

NodeJS express page takes too long to load


I have been working on a project for a while now using NodeJS and express to make a website. It is hosted on heroku right now.

When I was testing it during developement, I did not have any issues with load time. However when I tested it in a different Wifi than usual (which did not differ much in download speed from the usual) some pages suddenly take 40-60 seconds to load as seen below.

waterfall load of page

waterfall load long

What I don't understand is the big gap where nothing(?) happens.

I am still studying atm so I am still very inexperienced. Any help is greatly appreciated. I would also be thankful for any links to best practices on how to go about this as I couldn't really find anything that helped me.

And please let me know if there is any more information needed to diagnose this, thank you.


Solution

  • It's not "nothing" happening during the big gap. You just missed what is happening. Look at the top of the graph. You will see the long green bar that's downloading. That's what's happening. It is downloading the main html file (I think the url is /).

    It takes 38 seconds (38233 milliseconds) to load the html the first time and 52 seconds (52444 milliseconds) the second time. This is because your html file is 7.5MB - which is around two mp3 files.

    The download times are what I would expect from trying to download two mp3 files - around 1 minute.

    Find out why your HTML is 7.5MB. That's what is slowing the page load.