I have been puzzeled for awhile why my heroku node.js app is loading so slow, I see many questions raised on the same topic, and the main answer given is the "power down" / server sleep mechanism. However this is not what is slowing down my app load time. I have closely monitored my loading, and it seems as there is a big pause of 5 seconds before the assets begin to load. But why?
My app as a MEAN stack app, im using node.js 10, angular 5. I recently compressed my asset folder from 19mb to 7mb because I thought the size of those had to do with the load speed, but I still see this strange load pause of 4-5 seconds.
Right now I switched my heroku hosting plan back to "free" but a week ago I had the 7$ "hobby" plan. I bought the hobby plan as an attempt to increase the load speed, and it did seem to increse a very tiny bit, but still had this great pause.
This is regardless of how many users have been using the app, and how lately it have been active, by that I can exclude the problem to be related to the server sleep mechanism.
This particular app was bundled with the angular cli (probably using webpack under the hood). I found that building using command ng build --prod
would bundle the files much tighter and this eliminated the load time.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.