Search code examples
asp.net-coreseopagespeedpagespeed-insightsgoogle-pagespeed-insights-api

ASP.NET Core high TTFB(over 5 seconds) at first access to the site


I completed a website using ASP Core 3.1. I uploaded this website via Plesk panel to the hosting. When I control the website's speed on different sources, I saw the website has very bad TTFB, over 5 seconds,

But this is only valid for the first entry to the site. I asked this issue my web hosting company. They said that it was from API or an external file, but I could not understand.

Google PageSpeed Insights

enter image description here


Solution

  • This is my observation.

    1. When you don't access site for certain period of time , it will become ideal and most of hosting provider (shared hosting) unload that site and application pool.

    2. When next time any request comes then it will take sometime to load application again. This will also happen if you upload new version of your application.

    At IIS following configuration. (Advanced settings)

    1. Preload Enabled ( Site level)
    2. Start mode ( Application Pool Level)
    3. Ideal time out ( Application pool level)

    If you go for Azure Web App then there is a configuration in general settings like Always on.

    Now comes to your application , like are you loading any data on first request from external server or so. If so that latency also cause such issue.