问题描述
当我使用angular Universal运行我的应用程序时,我发现TTFB有巨大的差异. ssr比正常的角度命令花费更多的时间.如何使用角度通用服务器端渲染来改善TTFB?
When I run my application with angular universal, I am seeing huge difference in TTFB. ssr is taking more time than normal angular command. How to improve TTFB with angular universal server side rendering?
npm run serve:ssr
效果"标签:
ng serve
浏览了许多站点,但直到现在仍未在互联网上找到任何相关的解决方案.
Looked into many sites but didn't found any relevant solution on internet till yet.
推荐答案
似乎您有一个setTimeout或一个http调用,需要花费太多时间才能完成,并且只有在所有调用完成后,angular Universal才会为网页提供服务.
It seems that you have a setTimeout or an http call that takes too much time to finish and angular universal does not serve the webpage until all the calls are finished.
我建议您,如果超时或http调用对于呈现网页不是必需的,请避免在服务器端进行调用.
I recommend you that if the timeout or http call is not essential to render the webpage, avoid the call on the server side.
这篇关于Angular Universal TTFB非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!