Skills | Performance 22: Use Server.Transfer instead of Response.Redirect whenever possible
Tip 23: Use the back slash in the directory URL
Tip 24: Avoid using server variables
Tip 25: Upgrade to the latest and most outstanding
Tip 26: Optimize your WEB server
Tip 27: Perform a performance test
Tip 28: Read Resource Links
Tip 22: Use Server.Transfer instead of Response.Redirect whenever possible
Response.Redirect let the browser request another page. This function is often used to redirect users to a login or error page. Because redirection forces a new page to be requested, the result is that the browser must travel two times to the Web server, and the Web server must handle one more request. IIS 5.0 introduces a new function Server.Transfer that transfers execution to another ASP page on the same server. This avoids the extra browser-web-the server, which improves overall system performance and shortens user response times. Check the "New direction" in redirect, which should be Server.Transfer and Server.Execute.
See also leveraging ASP in IIS 5.0 for a complete list of the new features of IIS 5.0 and ASP 3.0.
Tip 23: Use the back slash in the directory URL
A related trick is to make sure that the backslash (/) is used in the URL that points to the directory. If you omit the backslash, the browser makes a request to the server, just to tell the server that it is requesting the directory. The browser issues a second request, which appends the slash to the URL, after which the server can respond with the default document or directory list for that directory (if there is no default document and directory browsing enabled). Additional slashes will save the first and useless live returns. To make it easier for users to read, you can omit the back slash in the display name.
For example, write:
<a href=?http://msdn.microsoft.com/workshop/? Title=? MSDN Web
Workshop?>http://msdn.microsoft.com/workshop</a>
This also applies to URLs that point to the home page on the Web site: using the following: <a Href=?http://msdn.microsoft.com/?>, instead of using <a href=?http://msdn.microsoft.com?>.
Tip 24: Avoid using server variables
Accessing a server variable causes the WEB site to send a special request to the server and collect all the server variables, not just the one you requested. This is similar to looking up a file in a moldy attic, in a folder. When you want to find the file, you must go to the attic and find the folder before you can find the file. When you request a server variable, the same happens-the first time you request a server variable, the performance is affected. Subsequent requests for other server variables do not have an impact on performance.
Never access an unqualified request object (for example, request ("Data"). For items that are not in Request.Cookies, Request.Form, Request.QueryString, or request.clientcertificate, an implicit invocation of the Request.ServerVariables. The Request.ServerVariables collection is much slower than the other collections.
Tip 25: Upgrade to the latest and most outstanding
System components are constant and we recommend that you upgrade them to the latest and best configurations. It is best to upgrade to Windows 2000 (therefore, you should also upgrade to IIS 5.0, ADO 2.5, MSXML 2.5, Internet Explorer 5.0, VBScript 5.1, and JScript 5.1). On multiprocessor computers, implementing IIS 5.0 and ADO 2.5 can significantly improve performance. Under Windows 2000, ASPs can scale well to four processors or more, while in IIS 4.0 the ASP cannot be extended beyond two processors. The more scripting code and ADO you use in your application, the more performance improves after you upgrade to Windows 2000.
If you are not currently able to upgrade to Windows 2000, you can upgrade to the latest versions of SQL Server, ADO, VBScript, and JScript, MSXML, Internet Explorer, and NT 4 Service packs. Both of these can improve performance and reliability.
Tip 26: Optimize your WEB server
There are several IIS tuning parameters that can improve site performance. For example, for IIS 4.0, we often find that adding ASP ProcessorThreadMax parameters (see IIS documentation) can significantly improve performance, especially on sites that tend to wait for back-end resources, such as databases, or other intermediate products, such as screen brushes. In IIS 5.0, you may find it more efficient to enable ASP Thread gating than to find a aspprocessorthreadmax optimal setting, which is now well known.
For better reference, see Optimizing IIS below.
The best configuration settings depend on (some of these factors) the application code, the system hardware that is running, and the client workload. The only way to find the best setup is to perform a performance test, which is what we'll discuss in the next tip.
Tip 27: Perform a performance test
As we have said before, performance is a feature. If you want to improve the performance of your site, set a performance goal and then step through it until you reach your goal. No, no performance tests are performed. Usually, it's too late to make the necessary structural adjustments at the end of the project, and your customers will be disappointed. Perform the performance test as part of your daily test. You can perform performance tests on individual components, such as for ASP pages or COM objects, or for a site as a whole.
Many people use a single browser request page to test the performance of a Web site. Doing so will give you a sense that the site is responding well, but doing so does not actually tell you what the site is doing under the load.
In general, to test performance accurately, you need a dedicated test environment. This environment should include hardware similar to the hardware in the production environment, such as processor speed, processor count, memory, disk, network configuration, and so on. Second, you must specify the workload of the client: how many simultaneous users, how often they send the request, the type of page they click, and so on. If you do not have the actual site usage data, you must estimate the use of the situation. Finally, you need a tool that can simulate the expected client workload. With these tools, you can start answering questions like "How many servers do I need if I have N simultaneous users?" "Sort of thing. You can also identify the causes of bottlenecks and optimize them for this purpose.
Some good Web load test tools are listed below. We particularly recommend the Microsoft Web application Stress (WAS) toolkit. is enables you to record test scripts and then simulate hundreds of or thousands of users accessing the WEB server. Was reported many statistics, including the number of requests per second, response time distribution, and error counts. Was a rich client interface and a web-based interface that allows you to test remotely.
Be sure to read the IIS 5.0 tuning Guide.
Tip 28: Read Resource Links
Here are some excellent resource links related to performance. If you would like to know more about this information, please read the developing scalable WEB applications.
Resources
Optimizing ASP Scripts
Optimizing IIS
ADO and SQL Server
ASP Components and threading models
Dictionary component
Session state
Performance and Scalability
Tools
Bibliographic
ASP Web Site
ASP style
Xml
Optimizing ASP Scripts
Developing Scalable WEB Applications
Got any Cache? Nancy Winnick cluts
Maximizing the performance of Your Active Server pages,nancy Winnick cluts
Seconds:performance section
Enhancing performance in Asp-part I,wayne Plourde
When is Better worse? Weighing the Technology trade-offs,nancy Winnick cluts
Speed and optimization resources,charles Carroll
Optimizing IIS
The Art and science of Web Server tuning with Internet information Services 5.0
Leveraging ASP in IIS 5.0,j.d. Meier
Tuning IIS 4.0 for high Volume Sites,michael Stephenson
Tuning Internet information Server performance,mike Moore
Navigating the Maze of Settings for Web Server performance optimization,todd Wanke
Managing Internet Information Server 4.0 for Performance,hans Hugli
ADO and SQL Server
Top Ten tips:accessing SQL through ADO and ASP,J.D. Meier
Improve the performance of your MDAC Application,suresh Kannan
Pooling in the Microsoft Data acce