1

I have problem with Angular 9 SSR server. My server has all time 10 sec to TTFB. This issue only occurs only on production server.

I followed with official Angular Universal Guide. I was looking for big time of API response or unnecessary timeout event eg. timer. The next thing I did was change lazy loading to preload modules which entry module need. I tryed also change ChangeDetection on Push.

This all point not improve my TTFB.

Have you any other ideas what can I do more or what should i change to improve it?

kalit
  • 256
  • 4
  • 15
  • Maybe try adding more memory to the nodejs process? Do you use angular animations? – David May 18 '20 at 10:25
  • I cannot add memory becouse this is hosting which client bought.How Angular Animation can affect on SSR? – kalit May 18 '20 at 10:50
  • I remember one SO question where SSR got stuck because of angular animations, so I thought it could be worth checking – David May 18 '20 at 11:21
  • Is it necessary to recreate the page on every request? If not, you could consider prerendering (available for Universal) or even SSG using Scully instead. – MikeOne May 18 '20 at 11:35
  • @David what if animation is part of third library (in my case of Angular Material) how can i prevent load it in server rendering? – kalit May 18 '20 at 12:13
  • @MikeOne can you more explain what you mean with SSG :) ? – kalit May 18 '20 at 12:13
  • SSG = static site generation. It means you generate a static version of the site locally (or in your build pipeline) that consists purely of html, css and js. Scully.io is capable of this and is a good replacement of using Universal. For an SSG site, you no longer need node.js or other serverside technology. – MikeOne May 18 '20 at 22:50
  • @MikeOne thanks for the idea but it won't help me because i have dynamic content on critical path :/ – kalit May 19 '20 at 08:28
  • Check. In SSG you'd have to solve dynamic content using API calls. If that is not feasible than that route is probably not suitable. – MikeOne May 19 '20 at 12:30
  • Is CPU usage going high while rendering? – David May 19 '20 at 15:54
  • @David I don't know because my hosting provider don't share any statistics like CPU or Memory usage – kalit May 19 '20 at 18:11
  • @MikeOne can SSG with dynamic content work well if i need seo? – kalit May 19 '20 at 18:13
  • Are you using ngrx? – David May 19 '20 at 18:14
  • @David i don't use it – kalit May 19 '20 at 18:19
  • It depends on what you mean with dynamic content really? If the content is based on a logged in user for example, then probably not. If your site has new content like hourly of daily, ssg is probably not suitable. – MikeOne May 19 '20 at 21:47

0 Answers0