extracted from: http://download.microsoft.com/download/6/4/3/643c270e-5f43-48c7-a0cd-0eb1a6c7c4f0/ScaleNet.pdf
Reduce Round Trips
Use the following techniques and features in ASP.NET to minimize the number of
round trips between a Web server and a browser, and between a Web server and a
downstream system:
● HttpResponse.IsClientConnected. Consider using the
HttpResponse.IsClientConnected property to verify if the client is still connected
before processing a request and performing expensive server-side operations.
However, this call may need to go out of process on IIS 5.0 and can be very
expensive. If you use it, measure whether it actually benefits your scenario.
● Caching. If your application is fetching, transforming, and rendering data that is
static or nearly static, you can avoid redundant hits by using caching.
● Output buffering. Reduce roundtrips when possible by buffering your output.
This approach batches work on the server and avoids chatty communication with
the client. The downside is that the client does not see any rendering of the page
until it is complete. You can use the Response.Flush method. This method sends
output up to that point to the client. Note that clients that connect over slow
networks where buffering is turned off, affect the response time of your server.
The response time of your server is affected because your server needs to wait for
acknowledgements from the client. The acknowledgements from the client occur
after the client receives all the content from the server.
● Server.Transfer. Where possible, use the Server.Transfer method instead of the
Response.Redirect method. Response.Redirect sends a response header to the
client that causes the client to send a new request to the redirected server by using
the new URL. Server.Transfer avoids this level of indirection by simply making a
server-side call.
You cannot always just replace Response.Redirect calls with Server.Transfer calls
because Server.Transfer uses a new handler during the handler phase of request
processing. If you need authentication and authorization checks during
redirection, use Response.Redirect instead of Server.Transfer because the two
mechanisms are not equivalent. When you use Response.Redirect, ensure you use
the overloaded method that accepts a Boolean second parameter, and pass a value
of false to ensure an internal exception is not raised.
Also note that you can only use Server.Transfer to transfer control to pages in the
same application. To transfer to pages in other applications, you must use
Response.Redirect.
More Information
For more information, see Knowledge Base article 312629, “PRB:
ThreadAbortException Occurs If You Use Response.End, Response.Redirect, or
Server.Transfer,” at http://support.microsoft.com/default.aspx?scid=kb;en-us;312629.
Sunday, February 04, 2007
Reduce Round Trips
at 6:43 PM Posted by roni schuetz
Labels: asp.net, development
Subscribe to:
Post Comments (Atom)
Shared Cache - .Net Caching made easy
All information about Shared Cache is available here: http://www.sharedcache.com/. Its free and easy to use, we provide all sources at codeplex.
No comments:
Post a Comment