Capacity Planning to Support ISAPI and CGI Applications

Although the data values vary widely among different servers, CGI applications and, to a lesser extent, ISAPI extensions, have much higher overhead than standard "static" pages. But the overhead of dynamic page-generating applications should not deter you from adding dynamic pages to your published files. The ability to monitor these applications and estimate their overhead during periods of varying activity allows you to prepare your server for the increased workload.

Some suggestions for optimizing your configuration to run applications that generate dynamic pages are:

Upgrading processors. CGI and ISAPI applications both benefit from faster processors. Fast processors are especially important to CGI applications in which each request runs in a separate, single-threaded process.

Adding processors. ISAPI extensions are multithreaded and can run simultaneously on multiple processors. Adding processors is probably the easiest way to improve the efficiency of ISAPI applications. CGI applications benefit from multiple processors, too. Even though CGI requests run in separate single-threaded processes, multiple CGI requests can each run on different processors simultaneously.

Adding memory. CGI applications typically use three to five times more physical memory than equivalent ISAPI applications.

Defragmenting your disks. If your cache performance declines over time, defragment the disk. Your files might have become fragmented over time.

Redesigning your static pages. Using current technology, even ISAPI, which is optimized for Windows NT, is far slower and less efficient than serving static pages. If you are generating pages dynamically to satisfy user preferences, consider substituting ten or twenty different static variations for a single dynamically generated page. If you are generating pages dynamically to provide frequently updated data, consider redesigning your application so that it generates a single dynamic page on a fixed schedule and then stores that page for repeated static retrieval until the next update.

Converting CGI Scripts to ISAPI Scripts. ISAPI is optimized to run on Windows NT. Converting CGI applications to ISAPI extensions can improve performance significantly in a small or large installation. (To see the magnitude of the difference on your server, run the WCAT CGI75 and ISAPI75 tests, and compare the results.) For instructions on converting CGI scripts to ISAPI DLLs, see the ISAPI Programmer's Reference in the Win32 Software Development Kit.

Incorporate logging in CGI and ISAPI routines. Add transaction logging functions to your CGI and/or ISAPI code. The transaction-logging function should record the time each incoming request was received and the time it was completed. Or, you can add extensible Performance Monitor counters to the code and use Performance Monitor to create the transaction log or monitor the routines. When delays arise, the transaction log will help you determine the source of the delay.

Despite their performance cost, dynamic Web pages are likely to increase in popularity and constitute a larger proportion of the average Web server file base as the technology progresses. The challenge for administrators is to preserve speed and efficiency while publishing ever more complex pages.

On Windows NT, CGI and ISAPI both have higher overhead than serving static pages from memory. But the difference between CGI and ISAPI performance is significant. In general, CGI applications are much slower and use more processor time and memory space than equivalent ISAPI extensions. Fortunately, you can measure the effect of CGI and ISAPI applications on the performance of your servers and upgrade your configuration to meet the challenges CGI and ISAPI pose.