Why is my ASP.NET application so slow?
This is a very short post that I wanted to create to help anyone else who may be experiencing this issue. This caused me a slight headache and so if I can help one person with this then great!
I recently published a .NET Core application to a brand new VPS and noticed every few minutes or so the load time was very slow. It took around 15 seconds to load the page, that is really slow for someone as impatient as myself! Anyway, I did some investigation and realised that the IIS app pool had an interesting setting that explained what was going on. The 'Idle Time-out' was set to 5 minutes, meaning the app pool would terminate if there was no traffic in that time period. The next user to load the site would then experience a slow load time which would put me off as a user. I had to set the timeout value to be 0 and the issue has gone! This setting is used in an attempt to keep the memory as low as possible when hosting multiple applications, in my case I am currently only hosting one application and so I am not too concerned in setting this to zero. But bear this in mind if you are hosting multiple applications and do consider the memory implications.
To access these setting follow the simple steps below:
- In IIS, select the Application Pools
- On the right hand side select Advanced Settings
- Change the Idle Time-out to 0