Reputation: 3549
When I publish or restart my web app it loads very slowly the first time, then when I refresh with F5 it is ok again. what could it be?
Upvotes: 2
Views: 4767
Reputation: 20067
It will happen with Windows Azure Websites. Windows Azure Websites are running in shared pool of resources and uses the concept of hot (active) and cold (inactive) sites in which if a websites has no active connection for x amount of time, the site goes into cold state means the host IIS process exits. When a new connection is made to that websites it takes a few seconds to get the site ready and working. Depend on how your first page code is, the time to load the site for the first time varies.
The IIS takes a while to boot up after you upload new files to the app container. Application Initialization module and deployment slot swap also takes several time.
So the first page hit after you've updated the app will be slower. Also Azure Web Apps get dehydrated after a period of inactivity. This also causes the first page hit to be very slow if the page hasn't been accessed in a while.
To combat this, in the Application Settings
for the web app, you can find a setting called Always On, which basically pings your page every couple minutes to keep the app hydrated and responsive.
For more details, you could refer to this blog.
As juunas said, you could also use Razor view pre-compilation
to speed up the initial loads. Otherwise the app must compile the views at run-time when they are first rendered.
Upvotes: 2