IIS Server performance is a common issued faced by many IT professionals. Sometimes it consumes too much memory. Sometimes the IIS gets so slow that you need to restart the process or recycle the app pool. There are many things that can cause your IIS to display this behavior. In order to solve the problem, let’s walk-through some key verification steps.
First of all we need to consider that some kind of change may have taken place, including a change to the code, database, content, Windows Updates, or a new, previously undetected condition.
There are some basic tools available which are mandatory for the preliminary analysis.
1) First: IIS Logs (%SystemDrive%\inetpub\logs\LogFiles).
Check your IIS logs, the logs will show you the last pages that have been executed.
Event Viewer is a powerful tool on Windows that can also help considerably because it is able to display IIS Errors and even Application errors that are occurring. Let´s check some other things that also need to be verified.
2) Code Changes
Code changes can be detected after a deployment of a new version on Production Servers. If you had a recent deployment on production servers and suddenly your application stops responding (App pool stops automatically) the cause could be a code change.
Cause number 2: "Infinite Loops": Search your code for words like "for" and "while." These sorts of commands are also dangerous, for some unknown conditions they can be in an infinite loop or executing too many times. I’d recommend that you place some Log lines before and after the loop commands, so you are able to check whether or not this is the issue that you are looking for.
Cause number 3: “Recursive Functions”: are dangerous and even more difficult to determine. If the exit condition is not achieved the function can enter into an infinite loop and can overload your system. Be careful when debugging these functions.
3) Database or content changes
Content is always changing. Sometimes you have content authors editing the webpages, and sometimes you run into problems with a system creating too much lines on a specific table. If you know that there’s a table on your database with too many entries, be careful: check the indexes as well as the queries that are being executed against that table.
Cause number 1: "Tables and Queries": When too much content is continually added to the table over time, the result is that the queries often become increasingly slow. Check the queries and look for "select *", this command can return all the data and make the procedure slower. Sometimes creating a "View" can do the job, and speed up queries.
Cause number 2: "Content": Sometimes a content author can add tags or large images/videos to a page that can cause the performance to slow down. Check with the users to see if they made any changes.
Cause number 3: “Hacking”: Servers are being attacked all the time. A hacker could create thousands of entries on your database which would definitively cause your application to crash. They could also execute SQL Injection codes that can damage or erase important configuration on tables, affecting your system as well. Numerous hits can result in a "denial of service." This can be caused by the hacker or even a crawler. Check your IIS logs to analyze the situation.
4) Windows Updates
This is something you don’t want to forget. Check to see if the server has "Install updates automatically" selected or talk to the infrastructure team. Check the last updates installed and Google the package name. There have been many updates in the last few years that triggered problems on the servers.
Finding the cause to this problem is always challenging, but I hope these tips help you find the best solution.