
In the last year, there has been a tremendous explosion in the technology used to support the World Wide Web. Perhaps the most significant aspect of this is the ability to extend the capabilities of a web server through customer-written scripts and programs. These extensions permit web users to tap into corporate data, place orders and inquire on their status, and limitless other things that the web server itself cannot do. In essence, the server becomes a conduit between the browser and the extension script or program. The latter handles the inquiry and generates the results, which the server routes back to the browser. Thus the web site can produce dynamic data in addition to serving static documents.
This paper shows that the majority of corporate applications should be developed using CGI technology. The recent media hype about pseudo-standard API technology and it's speed margin over CGI, overlooks some vital facts. Your choice of web server should be heavily influenced by its CGI (and SSI) capabilities and efficiency.
Three technologies are in use today for extending web servers:
Each of these technologies has its strengths and weaknesses. Each is best for extending the web server in certain ways.
Take a moment to study the table below, which compares the key characteristics of the three server extension techniques:
| Flexibility & Power | |||
| Developer Expertise Required | |||
| Development & Testing Time | |||
| Adaptability to Change | |||
| Life-Cycle Cost | |||
| Operational Risk | |||
| CPU Overhead(1) |
(1) exclusive of the work required to generate the content. The so-called null overhead.
Since SSI is a substitution mechanism, where text is inserted into a document at tagged locations, it has the lowest flexibility of the three. Some implementations of SSI have crude logical branching capabilities, but none can match the power of real programming languages. CGI and API are both implemented with real programming languages. Both offer total flexibility and great power. Facilities such as OLE or ODBC are available to both, giving extension developers access to a wide variety of data sources and tools.
CGI and API extensions are equally flexible and powerful.
SSI requires little development expertise beyond writing HTML. CGI programming can be done using very widely known tools such as Visual Basic and perl. Developers with this level of expertise can often be found within companies and who are already familiar with the company's operations. API development requires an expert developer that is familiar with exotic programming techniques such as multithreading and concurrency synchronization, network protocol programming, and structured exception handling. It is unusual for such developers to work for non-technology companies, so they must be brought in as consultants. They will not be familiar with the company's operations. Once they are finished and leave, their work products are frozen. To make changes to these server extensions, you must bring the consultant back, or bring in another consultant who starts at ground-zero in company operational knowledge and understanding the API extension code that the first consultant developed.
API extensions require highly specialized (and expensive) developers.
SSI requires the least development and testing time. Development consists of placing markers (tags) into HTML documents. The server inserts data from other sources into these markers. CGI development and testing time can vary widely, depending on the complexity of the task to be performed. Since the CGI program can be tested offline, independent of the server, testing can usually be accomplished relatively quickly. In addition, since CGI extensions are separate programs, they cannot affect the operation of the server itself. Failure of a CGI program is benign to the server. API extensions require far more rigorous testing, since they are mapped into the server's memory space, and can corrupt the server's internal data. Before installing an API extension on a production server, it must be thoroughly tested to assure that it will not cause server crashes.
API extensions require the longest development and testing time.
Most commercial web extensions are developed to enhance a business process, and they implement business rules. Adaptability to changing business conditions is incredibly important. Ask any large bank executive: the aging technology and inflexible data processing infrastructure in many large banks is their single biggest competitive restraint.
SSI extensions are, by their nature, easy to adjust as things change. CGI extensions can normally be developed by in-house personnel using the same programming systems (for example, Visual Basic) that are used to develop other in-house applications. In-house developers are generally familiar with the operational issues of the business, and they can maintain and adjust the web server extensions to match business changes.
API extensions usually require specialized contract programmers. When they leave, the application is frozen until they are brought back in, and they may not be available when they are needed. Also, contractors are rarely familiar with the operations of a particular company or the areas in which the company wants to gain a competitive advantage. Finally, the development and testing cycle is longer, because the altered extension must be re-certified as server-safe.
API extensions are the least adaptable to change.
SSI extensions have the lowest life-cycle cost, because they require the least programming, require the least level of programmer expertise, and are the easiest to adjust to changing business needs. CGI extensions can be cost-effective if they are developed using in-house programmers, working in common development environments such as Visual Basic or Delphi, who who are familiar with the operations of the business. Changes can be accomplished in a timely manner and are likely to match the needs of the business without iterative testing. Plus CGI extensions do not pose a risk to the production operation of the web server itself and so do not need server-safety testing. API extensions have the highest life-cycle costs, requiring expensive (probably contract) programmers, taking the longest time to make maintenance changes, and requiring iterations to meet the goals of a potentially unfamiliar business.
API extensions have the highest life-cycle costs, all else being equal.
SSI and CGI extensions both have low operational risk. SSI extensions work or don't work. CGI extensions can have programming bugs, which cause them to fail as well. However, API extensions can fail in a way that causes the entire server to crash. Some APIs (such as O'Reilly Software's WSAPI and Microsoft's ISAPI) have safety mechanisms to protect the server against some forms of API extension failure. However, if the API extension mistakenly writes into the server's private data (which it can easily do), it will likely cause a fatal crash of the server.
API extensions are the most risky to server production operation.
Here we consider the CPU overhead associated with the extension mechanism itself. SSI has inherently high CPU overhead, as it must scan through the entire HTML document, searching for the insertion markers and inserting the dynamic data at each such point. If the server does not buffer the final data stream, or if it byte-picks through the original HTML document, the overhead can be extreme and the network efficiency can be poor. This potential problem is difficult to assess in a pre-purchase situation.
CGI has a moderate CPU overhead, primarily due to the fact that a program must be started for each received CGI request. It is commonly thought that this overhead is high; however, it is not a high as is commonly believed. On a 486/66 system running Windows NT 3.5, a moderate-sized Visual Basic 4 program can be started in a few hundred milliseconds, or at a rate of 18,000 per hour. This number gets better if the CGI program is frequently accessed and its code bits happen to be in the disk cache. This level of performance is critically dependent on the system having sufficient RAM available so as to avoid excessive page faulting.
API extensions have the lowest CPU overhead, as they are loaded at server startup and run in the context of the server itself. Again, however, performance is critically dependent on the system having sufficient RAM. If the system is memory-starved, the API extensions will fight it out (along with the server itself and everything else running on the system) for the available physical memory. An API extension may be somewhat smaller than an equivalent CGI program, so API is somewhat less RAM intensive.
API extensions have the lowest CPU overhead.
Taking all of this into consideration, you can see that API-based extensions have but one advantage: CPU overhead. In all other respects, CGI and SSI technologies better suit most business needs. CPU power is cheap and getting cheaper. People power is expensive and getting more expensive. Finding a reliable and capable systems programmer to write API extensions is difficult. Keeping such people on staff is a luxury that only the largest corporations can afford. Why not spend a bit more on CPU and RAM and enjoy all of the other benefits of CGI- and SSI- based extensions?
I expect to see API extensions that (for example) provide built-in support for interpreted or pseudo-compiled languages such as perl and Java. Making a Java or perl interpreter run as an API extension saves the CPU overhead of a program launch, and the extension itself is not subject to frequent changes in business rules. The scripts that the interpreter runs are the changeable component. So the language vendor can spend the time and money to develop and test the extension interpreter and then release it as a commercial product, an add-in for the web server.
[email protected]
Copyright © 1994-96 O'Reilly & Associates, Inc.
All Rights Reserved.
O'Reilly Software Online, WebSite Central, WebSite, and
WebSite Professional are trademarks of O'Reilly & Associates, Inc.
All other names are the trademarks of their respective companies.