Click to return to the Server Technologies home page    
Web Workshop  |  Server Technologies

Maximizing the Performance of Your Active Server Pages


Nancy Winnick Cluts
Based on a presentation by Philip Carmichael
Microsoft Corporation

March 4, 1998

Contents
Introduction
What Is ASP?
Know Thyself
ActiveX Server Components and ASP
Database Concerns
ASP Tips and Top Ten List
Additional Resources
Summary

Introduction

Active Server Pages (ASP) provides a consistent, easy-to-use interface to Web-based clients. With ASP, you can connect your user interface (HTML) with business logic. ASP also provides a secure environment for Web applications that require transactions. This article will give you the information you need to maximize the performance of your ASP scripts. In this article we will discuss:

This article is based on the presentation "Maximizing the Performance of Your Active Server Pages," (DWA 05) by Philip Carmichael at Web Tech·Ed, January 25-28, 1998, in Palm Springs, California. This presentation is available via NetShow. Check http://www.microsoft.com/training/seminars/wte.asp for details.

Microsoft will present additional Web-related technical-solution sessions in June at Tech·Ed 98 in New Orleans. See the Microsoft Events site at http://www.microsoft.com/events/teched/ Non-MSDN Online link for details and registration information.

TopBack to top

What Is ASP?

Active Server Pages (ASP) technology provides the environment in which you can run scripts on the server. If you can write HTML, you can create an ASP file. It's really that easy. Your ASP file is simply a file that can contain any combination of HTML, scripting, and calls to components. When you make a change to the ASP file on the server, you need only save the changes to the file -- the next time the Web page is loaded, the script will automatically be compiled. Of course, to take advantage of ASP, you'll want to add features the script that will run on the server, such as database access or other network-related work.

ASP might be new to us, but it's being used widely on the World Wide Web. Aside from Microsoft Web sites (including the beloved MSDN Online Web Workshop Web site), sites such as NBC (http://www.nbc.com Non-MS link), Nasdaq (http://www.nasdaq.com Non-MS link), and even the maven of good things, Martha Stewart (http://www.marthastewart.com Non-MS link), take advantage of the power of ASP. If ASP is new to you, take a look at An Asp You Can Grasp: The ABCs of Active Server Pages for an overview.

TopBack to top

Know Thyself

You can be a technically good scripter as far as correct syntax goes, but if you write script that is unreadable, it becomes unmaintainable. It is important to follow some kind of scripting file standard to maximize performance and ease maintenance.

Some things to keep in mind are:

TopBack to top

ActiveX Server Components and ASP

ASP supports the use of ActiveX server components. ActiveX server components provide a scriptable interface to your ASP via the Component Object Model (COM). If you are creating your own ActiveX server component for the server, don't give it a graphical user interface -- the client won't see it. You have several options with components. You can reuse components that you have already bought or developed, you can buy new components, or you can build your own. There are pros and cons to each of these options. You can also select the scripting language you prefer when working with an ActiveX server component.

There are several components built directly into IIS for your use, including:

Server Scriptlets

An easy way to get started with server components is to create server scriptlets. Scriptlets enable you to create small components of script that you can reuse across your site. This script can carry out common tasks such as accessing data, performing business logic, or participating in a transaction. Server scriptlets, which are reusable COM components written in script, are very simple to create via the popular scripting languages (that is, Perl, JScript, and VBScript). This technology is currently in beta test (available at http://www.microsoft.com/scripting/scriptlets/). To create one, check out the Microsoft Scriptlet Wizard.

ActiveX Server Components and ADO

ActiveX Data Objects Non-MSDN Online link (ADO) provides the commonly used mechanism for connecting to databases. These objects are used primarily by business components. Those of you familiar with Data Access Objects (DAO) and Remote Data Objects (RDO) should find the programming model Non-MSDN Online link for ADO familiar. ActiveX server components can use ADO to work with databases to provide content based on user preferences, geographical data, or any other criterion.

The article So Happy Together? Using ActiveX Components with Active Server Pages gives you more information about the basics of ActiveX components and ASP, and about using ADO with ActiveX server components.

TopBack to top

Database Concerns

Most people will want to take advantage of information stored in a database for their Web sites. This goes for businesses, who may have customer lists or inventory, and for the well-connected home user who has their friends' contact information, CDs, and movies stored in a database (doesn't everyone have six machines on their home network?).

SQL Server

To get the most out of Microsoft SQL Server, the following tips apply:

Performance Testing

Let's say that you are responsible for creating a Web site and decide to use Active Server Pages. Now let's say that your incredible team is down to a zero bug count and the site has remained stable for a week. You are thinking, "Ship it!" Of course, if you didn't test performance, you might find that your technically correct Web site is as slow as a slug. It's important that you take performance issues into consideration when you are designing your Web site. Trying to improve performance at the end of the development cycle can prove to be daunting -- at that point, you really don't want to re-architect the site and you certainly don't want to rewrite every single page.

Use Sessions Wisely

Use sessions to save user data in memory when you will need to access that data frequently. Use persistent storage (ADO) to save data that you need to access less frequently. Do not use sessions where they are not needed -- it will decrease your performance.

Stress and Performance Counters

There are some nifty tools that you can use to measure and stress your Web site. I know; why would I want my Web site to be stressed? Life is so difficult already; shouldn't we all just try to relax? Well, you won't be relaxed if visitors to your site send you nasty e-mail about its performance at peak connectivity time. I say, stress the Web page -- not the Web author.

Take advantage of the Web Capacity Analysis Tool (available online at http://www.microsoft.com/workshop/server/toolbox/wcat.asp). This tool runs simulated workloads on a test Internet Information Server (IIS). By using this tool, you can test the responsiveness of your .asp files. After you run the tests, you can decide how you want to tune your .asp files. You can also take advantage of third-party testing tools to determine the performance of your Web site. Whichever tool you choose is up to you. Testing performance is a very worthwhile endeavor, so don't get hung up on which tool to use; just do it.

The IIS Resource Kit provides invaluable information on the performance tuning and design of your Web sites. The kit provides tools such as WCAT (described above), an HTTP monitor, a migration wizard, and a sign-up server.

Other quick tips for performance testing include:

TopBack to top

ASP Tips and Top Ten List

Here's a list of the top ten things to keep in mind when you are working with ASP. This list should get you started in the right direction. For a comprehensive explanation and list of tips, refer to the article 15 ASP Tips to Improve Performance and Style.

  1. Design for success.
  2. Use application state for caching output.
  3. Create and modify ProcessorThreadMax registry value.
  4. Use system DSNs, not file DSNs or DSN-less DSNs.
  5. Enable buffering for all Applications.
  6. Use Microsoft Transaction Server "Library" Packages.
  7. Disable Session state, if not used.
  8. Use OptionExplicit with VBScript.
  9. Make ADO free-threaded if you use SQL Server.
  10. Modify the metabase AspScriptEngineCacheMax value.

TopBack to top

Additional Resources

For more information about ASP, click the following links:

Summary

With the information you have now, you can create ASP files that include clean script that runs fast. Take advantage of the resources I've given you and don't forget to test! Keep checking this site as well as the IIS site for updated information about ASP and let us know what else you are interested in reading about. Of course, if we've covered it all flawlessly, you can tell us that, too!



Back to topBack to top

Did you find this material useful? Gripes? Compliments? Suggestions for other articles? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.