Ok, i told abot our problem yesterday. For some reason, the .net framework was throwing an error to event logs, saying that connection pool is full, and it couldnt connect to the database so the site was down. We rebooted the servers, restarted iis etc, this solved the problem for only a few hours. Of course our first intention is to go to the code and try to find the connection leaks, and fix them, but in the mean time what are we going to do ? when the site isnt working, your first goal should be making the site work, not coming up with the best solution.
My first dirty, fast solution is turning off the connection pool. To do this, open your web.config file, go to connectionStrings node, and inside the connection string properties add: "Pooling=false;". This will turn off all the pooling, I did this, and site came back alive, i was suspecting a slow web site, as now there is a hit on the database everytime the page loads, a connection is created everytime. Our daily hits is like between 25-35000. The default page is hitting the database 4 times to query 4 different tables, and guess what we dont have caching. The simple calculation shows that we hit the sql server 120,000 times/day just to display the home page. If there is a leak in the connections, it is pretty costly. So anyways, we turned off the pooling, and next thing is, i asked the server admins to monitor the sql server resources as we might be using lots of cpu and ram for not using pooling. They told me after a day that, sql server was ok, no performans problems :) sweet!!, so i turned off connection pooling, and site is working without putting a load on the sql server. Then why do we have pooling enabled ? :) probably it ll be even faster once we fixed the leaks.
We found out that one of our programmers do not open the connections inside a try catch block, also not disposing the sqldatareader. So we are fixing those (see yesterday's blog about the solution), and also we started to implement a caching mechanism so that the first time page is loaded, we will read the data from the database, put it in the cache. I ll measure the performance, before and after and will let you know what happens :)