• subscribe
June 01, 1998 12:00 AM

Optimizing Dynamic Web Content for IIS

Windows IT Pro
InstantDoc ID #3474

Because you include ASP scripts in the same page as static HTML content, ASP provides a simpler programming model than CGI or ISAPI for creating dynamic Web content. ASP's simplicity makes development of dynamic content available to a larger population of Web developers. If you are familiar with VB and HTML, you can easily develop ASP Web pages.

Listing 3 is a simple ASP page that uses ASP's built-in Response object to place a text string in the HTML stream that IIS sends to the user's browser. The <% %> symbols identify script that the ActiveX scripting engine needs to interpret. For more information about ASP, see the IIS SDK.

Check the Performance, Please
Which of IIS's three mechanisms for developing dynamic Web content is best? Many developers use ASP because it's powerful and easy to use. But that doesn't mean ASP offers the best performance.

To get a sense of the relative performance of the three types of dynamic Web content, I ran some simple tests using Microsoft's Web Capacity Analysis Tool (WCAT), which comes with Microsoft Windows NT Server 4.0 Resource Kit, Supplement Two. (For more information about WCAT, see T.J. Harty, "Testing Your Web Environment," December 1997.) My test environment consisted of three computers: My Web server was a Compaq Deskpro 6000 with a 200MHz Pentium Pro processor and 64MB of RAM running Microsoft Windows NT Server 4.0 with Windows NT 4.0 Option Pack (which includes IIS 4.0). The controller for my tests was an AT&T Globalyst 730 with a 100MHz Pentium processor and 48MB of RAM running NT Server 4.0. My client machine was a Compaq LTE 5400 with a 150MHz Pentium processor and 80MB of RAM running Windows 95.

I tested the responsiveness of five different Web implementations: static HTML, CGI, ISAPI, ASP with no script, and ASP with a small script. Each page responded to a simulated Web browser's request for its contents by providing the text string "Hello, I must be going!" I used the CGI, ISAPI, and ASP (with a small script) code that Listing 1, Listing 2, and Listing 3 show, respectively. I used the static HTML program that Listing 4, page 173, shows as a baseline for comparing the other implementations. The ASP page with no script was identical to Listing 4, except the file extension was .asp. Testing ASP pages with and without scripts let me differentiate between the overhead the ASP ISAPI extension places on a page and the overhead ASP code with script creates.

For each implementation, I used WCAT to repeatedly run a thread from the client machine to the Web server that simulated a browser's HTTP get requests for the implementation's URL. Each test lasted 3 minutes, and WCAT measured the number of times each implementation produced the "Hello, I must be going!" string per second. I repeated the battery five times for each implementation and averaged the results, which Graph 1 displays.

The ISAPI extension was the fastest, opening an average of 168.43 pages per second. The static HTML page was close behind, with an average of 159.35 pages per second. My ASP page without a script registered an average of 133.16 pages per second, and the simple script in my second ASP page reduced the page's responsiveness to an average of 124.91 pages per second. CGI opened only an average of 39.13 pages per second.

These simple tests demonstrate the relative performance of each type of dynamic Web content, but the data doesn't correspond to response times for most Web pages. Real Web pages access far more complex content, including databases, sophisticated algorithms, and legacy data. Adding complexity to any form of dynamic content lengthens a page's response time substantially.

Evaluate Your Content
CGI pages produce the slowest response times because of the overhead they require to create new processes and direct information through communication pipes. ISAPI extensions offer the fastest response times because you implement them as in-process DLLs. ASP pages are in the middle, primarily because of the runtime script interpretation they require to process pages.

If you're responsible for managing your Web site's performance, consider the way you produce dynamic content. Focus on the pages that get the most hits and show the most sluggish response. You can easily identify which pages get the most activity using a tool such as Microsoft's Usage Analyst, which is part of Microsoft Site Server, Standard Edition. If any of your busiest pages are dynamic and if those pages have slow response times, examine the dynamic content's implementation and consider rebuilding the page. For example, if your logon or search screen is currently an ASP program, you might replace it with a faster ISAPI extension.

However, if speed isn't a problem with a particular page, I recommend sticking with ASP. It's simple, and you needn't over-engineer your site's performance.



ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here