|
To access the contents, click the chapter and section titles.
Platinum Edition Using HTML 4, XML, and Java 1.2
Of course, the choice of programming language will affect each variable greatly. A tight little C program hardly makes an impact, whereas a Visual Basic program, run from a wrapper and talking to an SQL Server back end, will gobble up as much memory as it can. (Using Active Server Pages (ASP) on Microsoft Information Server resolves this problem, reducing the load on the server. See Chapter 33, Active Server Pages and VBScript, for more details on ASP.) Visual Basic and similar development environments are optimized for ease of programming and best runtime speed, not for small code and quick loading. If your program loads seven DLLs, an OLE control, and an ODBC driver, you may notice a significant delay. UNIXUNIX machines are usually content with significantly less RAM than Windows NT computers, for a number of reasons. First, most of the programs, including the operating system and all its drivers, are smaller. Second, its unusual, if not impossible, to use an X Windows program as a CGI script. This means that the resources required are fewer, although with the prices of processor speed and drive and memory megabytes falling, the difference in hardware cost is not that great. Maintenance and requisite system knowledge, however, are far greater. Trade-offs occur in everything, and what UNIX gives you in small size and speed, it more than makes up with complexity. In particular, setting Web server permissions and getting CGI to work properly can be a nightmare for the UNIX novice. Even experienced system administrators often trip over the unnecessarily arcane configuration details. Things are getting better, though. You can buy preconfigured servers, for example, and many do-it-yourself Linux administrators are glad for Redhat. After a UNIX-based system is set up, however, adding new CGI scripts usually goes smoothly and seldom requires adding memory. If you give your UNIX computer 16MB of RAM and a reasonably fast hard disk, it will run quickly and efficiently for any reasonable number of hits. (Of course, you may not want to skimp on RAM when memory prices are low.) Database queries will slow it down, the same as they would if the program werent CGI. Due to UNIXs multiuser architecture, the number of logged-on sessions (and what theyre doing) can significantly affect performance. Its a good idea to let your Web servers primary job be servicing the Web rather than the users. Of course, if you have capacity left over, no reason exists not to run other daemons, but its best to choose processes that consume resources predictably so that you can plan your site. A large, popular siteone that receives several hits each minute, for examplewill require more RAM, the same as on any platform. The more RAM you give your UNIX system, the better it can cache, and therefore, the faster it can satisfy requests. CGI Script StructureWhen your script is invoked by the server, the server passes information to the script via environment variables and, in the case of POST, via STDIN. GET and POST are the two most common request methods youll encounter, and probably the only ones youll need. (HEAD and PUT are also defined but seldom used for CGI.) The request method tells your script how it was invoked; based on that information, the script can decide how to act. The request method is passed to your script using the environment variable called, appropriately enough, REQUEST_METHOD.
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |