简体   繁体   English

5秒未加载,heroku node.js app加载缓慢

[英]5 seconds of not loading, heroku node.js app slow loading

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. 我已经有一段时间了解为什么我的heroku node.js应用程序加载速度很慢,我看到同一主题提出了很多问题,主要答案是“断电”/服务器睡眠机制。 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. 我已经密切监视了我的负载,看起来在资产开始加载之前有5秒的大停顿。 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. 我的应用程序作为MEAN堆栈应用程序,我使用node.js 10,角度5.我最近将我的资产文件夹从19mb压缩到7mb因为我认为那些大小与加载速度有关,但我仍然看到这个奇怪的负载暂停4-5秒。

Right now I switched my heroku hosting plan back to "free" but a week ago I had the 7$ "hobby" plan. 现在我把我的heroku主机计划改回“免费”,但一周前我有7美元的“业余爱好”计划。 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). 这个特殊的应用程序与角度cli捆绑(可能使用引擎盖下的webpack)。 I found that building using command ng build --prod would bundle the files much tighter and this eliminated the load time. 我发现使用命令ng build --prod文件捆绑得更紧,这消除了加载时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM