A colleague and me where thinking about this, because we were copying files to the root directory of the web site. But no worries, this doesn't trigger a recycle. What does trigger a recycle?
Trigger Immediate Recycle
- Web.config changes
- Machine.config changes
- Global.asax changes
- Bin directory changes
- App_Code changes
In my previous post, I proposed a way of trying to figger out where performance problems are.
Now I discovered a possible problem in our existing classic ASP website. On several places, the server tag:
<%Response.Buffer = false%>
Now what exactly happens when this is set on top of the page?
When the Response.Buffer is set to false, every Response.Write is sent immediately to the client. If response buffering is enabled, then these writes are grouped and sent to the client in one larger, more efficient transaction. From IIS 5 this is by default enabled on the server (they did that for a reason).
In our case there are loops and sometimes these loops go over 100 rows. In the loop there are more then 50 Response.Write tags. So image when the Response.Buffer is set to false. It will result in 100 * 50 connections from server to client. that's 5000 connections. Now when the load on the server gets higher and 100 users are opening the same page on the same time, it's 500000 connections. This will blow up the server and breaks performance.
|5000 Response.Write||Response.Buffer = false||Response.Buffer = true|
|1 user||5.000 connections||1 connection|
|100 users||500.000 connections||100 connections|
If your page is very large, and the processing very long you may want to periodically flush the response buffer to the client. This will ensure that the client steadily receives data and does not time out. If you are building large tables in a loop you may want to add Response.Flush every 100 rows or more.
It can also happen that the Buffer Limit is reached and the response is cancelled. By default the Response Limit is set to 4Mb. You could increase the to max 20Mb. But even better, you could improve the page itself by using Response.Flush every n rows or simply check if the page could be rewritten. You do not want to sent page over 10Mb to clients.
Responsiveness can be achieved by other ways, like showing a loading message, Response.Flush it and hide it in the end of the response. Or flush loops over n number of rows.
I have several techniques to analyse an old asp application.
Off course reading the code, but some large pages can be totally unreadable.
In my case all calls to the DB where performed through the same functions. So there I put a file logger. Now all SQL calls to the DB are logged in a file. Later I could analyse them and have some more idea what's going on.
stringToLog = FormatDateTime(Now()) & ": " & stringToLog