000831.html | WebReference


((((((((((((((((( WEBREFERENCE UPDATE NEWSLETTER ))))))))))))))))) August 31, 2000


This newsletter sponsored by: Searchbutton, Allaire, IBM and Bot 2000 __________________________________________________________________


Help your Web site visitors find what they're looking for - add site search today! www.searchbutton.com/lp/icnews.html The preferred solution recognized by webmasters worldwide.


http://www.webreference.com http://www.webreference.com/new/ http://www.webreference.com/new/submit.html New this week on WebReference.com and the Web:

1. OPEN PUBLISHING: Submit Your Article Today! 2. FEATURED ARTICLE: Persistent Perl on the Virtual Host 3. NET NEWS: * Word Documents With Ears? * Amazon.com Coming Clean on Privacy * Microsoft Boosts New MSN Browser * Intel Says Faulty Pentium III Will Return

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1. OPEN PUBLISHING: Submit Your Article Today!

Every Thursday the Update features a new article contributed by our readers through our Open Publishing Initiative. We encourage you to submit your own article ideas. Your words could be here!


This week, writer Mark Porter discusses a work-around to hosts that won't give you the scripting access you need, with a handy little program called SpeedyCGI. Read on to find out how your site can benefit!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2. FEATURED ARTICLE: Persistent Perl on the Virtual Host

One of the big problems with the Perl programming language is that when executed there is a lag in performance due to the actual perl interpreter starting up. In addition, each process starts another instance of the interpreter to handle the request. This fact has long been known and many programs have been created to keep the perl interpreter in memory, thereby avoid the startup costs, and letting the script run at speeds that rival C and C++ programs.

The two most popular programs are mod_perl and FastCGI. Both are free so why isn't the average Web site owner using one of them? One reason might be that both programs have hooks into the Web server and running a bad application has the potential to bring down the Web server. Most hosting companies will not let that happen so they will not allow their users to access these programs.

So what can all of us folks do that are running our Web sites on 30 mb of space on someone else's server? As long as you have telnet access to your domain there is something you can do about it.

CGI::SpeedyCGI written by Sam Horrocks is just what the doctor ordered to get your scripts running approximately 16 times faster than normal. It can be installed using the PREFIX tag in the Makefile command on virtual hosts. The installation of this module to a virtual host is different than installing a standard module so be sure to read the installation instructions closely.

>How it works

After the script is initially run, instead of exiting, SpeedyCGI keeps the perl interpreter running in memory. During subsequent runs, this interpreter is used to handle new requests, instead of starting a new interpreter for each execution. SpeedyCGI conforms to the CGI specification, and does not work inside the Web server. A very fast cgi-bin (written in C) is executed for each request. This fast cgi-bin then contacts the persistent perl process, which is usually already in memory, to do the work and return the results.

Since all of these processes run outside the Web server, they can't cause problems for the Web server itself. Also, each perl program runs as its own Unix process, so one program can't interfere with another. Command line options can also be used to deal with programs that have memory leaks or other problems that might keep them from otherwise running persistently.


1. To run any persistent process with Perl the scripts need to be correctly scoped. Lexical scoping prevents variables from piling up on each other by releasing the memory back to the server. Since the process is persistent, a variable that is global will just concatenate on itself each time the script is run. To combat this problem, programs must declare variables using "my." This means that not every script on the Web will run persistently. If the script does not have "use strict;" written somewhere near the top, then it is probably not scoped and should not be run persistently. For a complete definition of scoping, visit http://www.plover.com/~mjd/perl/FAQs/Namespaces.html

2. When you run Speedy on a virtual host, Speedy forks off another version of itself for each user so it isn't advisable that you run every script with it. Speedy has a time-out variable that can be set on each script that will keep the Speedy process running even if the user quits using the script. If you set this time-out to 600 seconds it takes that long for the process to stop. This can cause problems for the server if you suddenly have a lot of Speedy processes that are sitting there waiting to quit. Under heavy load you may run out of sockets since they hang around in a TIME_WAIT state after closing. Most servers are set up to handle at least 256 users so it shouldn't be a problem as long as you keep your time-outs at around 60 seconds.


Learn why Allaire ColdFusionR is the fastest way to develop and deliver scalable Web applications. Join us for a FREE, introductory, one-hour CyberSeminar on the industry's leading cross-platform Web application server. You may win a FREE copy of ColdFusion Server Professional - a $1,295 value! Register today at http://www.allaire.com/cfcyber/webref


If you have root access and are running the Apache Web server then this is no problem because Speedy also comes with mod_speedy, which keeps the program from forking another process for each request. You can't install mod_speedy without root access though.

By the way, mod_speedy doesn't hook into the Apache Web server the way mod_perl and FastCGI do so it's a very safe way for Web farms to implement persistence on their servers!


To install SpeedyCGI on a virtual host takes a little extra work than a standard module, but it's worth it. The first thing you need to do is download the module from http://search.cpan.org, then unpack it into a directory on your host. For those not familiar with how to do this, here's a step by step guide.

To unpack and install type the following commands at the telnet prompt: (SpeedyCGI can't be installed on NT so don't waste your time trying).

gunzip CGI-SpeedyCGI-1.8.3.tar.gz tar -xvf CGI-SpeedyCGI-1.8.3.tar cd CGI-SpeedyCGI-1.8.3 perl Makefile.PL PREFIX=/home/domain (full path to your domain) make make test

Now here's the trick to get it to install because it will always fail in it's default state. Depending on your path to perl this might be a little different, but it will be easy to spot if the make install fails.

Create a "bin" directory in your domain: /home/domain/bin

With Perl located in /usr/local/bin/ you may have to create the directory /home/domain/local/bin. It appears that Speedy is trying to emulate where Perl is installed on the server. If you get an error and it complains about not being able to find the directory then this is most likely the problem and you can simply create the required directory and run make install again.

Once that directory is created, go back into the SpeedyCGI directory and type:

make install

If all goes well you will now have Speedy installed. The shebang line will be a little different than what you're used to, though. The following line reflects that you are running the Speedy executable in your own domain space.

#!/home/domain/bin/speedy -w -- -t60

SpeedyCGI command line options will always follow the -- on the shebang line. Any options before the -- are perl options. The above line reflects a time-out of 60 seconds. There are some other useful options so you should refer to the documentation to get a thorough understanding of Speedy commands.


It's a different kind of world, stay ahead with WebSphere Application Server v3.5, the foundation of the WebSphere software platform for e-business. v3.5 provides a single integrated development environment allowing you to quickly build next generation e-business applications. Click here for trial code.



About the author:

Mark Porter is a Perl Monger and has been programming perl for about three years. He currently owns his own business, imChat Inc. (http://imchat.com/) which is merging with another business, Balsa-Tech Inc. (http://balsa-tech.com/). They sell business intelligence software, do custom CGI programming and are currently looking for startup capitol. Contact Mark at perl@imchat.com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3. NET NEWS: Word Docs With Ears?, Amazon.com Coming Clean on Privacy, Microsoft Boosts New MSN Browser, Intel Says Faulty Pentium III Will Return

>Word Docs With Ears?

A privacy group warned Wednesday that so-called "Web bugs" could track Microsoft Word documents as they are distributed among Internet users. "A word-processing document can 'phone home,'" explained software analyst Richard Smith, chief technology officer at the Privacy Foundation. http://www.wired.com/news/technology/0,1282,38516,00.html Wired.com, 000831

>Amazon.com Coming Clean on Privacy

They store any information you may enter on their Web site. They use cookies to track you. They sometimes buy information about you from other sources. They are Amazon.com, and they are no different from lots of other e-tail operations, except that today they adopted a beefed up disclosure policy. http://www.internetnews.com/ec-news/article/0,,4_450381,00.html InternetNews.com, 000831

>Microsoft Boosts New MSN Browser

Microsoft Corp. is issuing an improved version of a new Web browser that blends in video and music capability and content from its MSN Internet service, in what is the opening shot in the software giant's biggest assault yet on Internet rival America Online Inc. http://www.zdnet.com/zdnn/stories/news/0,4586,2622146,00.html ZDNet.com, 000831


Bot 2000 Seminar - September 13th at the New York Hilton Expert Bot / Intelligent Agent Developers, Researchers and Academics present the latest happenings and give specific information for cost effective solutions to improve business. A rare opportunity to network, share ideas, and put theory and research into practice. http://seminars.internet.com


>Intel Says Faulty Pentium III Will Return In 'Couple Months'

Intel will take a couple months to review and refine its speediest chip before the company continues its production and begins shipping it again. They intend to address why the 1.13GHz chip was freezing under certain test conditions. http://www.cnn.com/2000/TECH/computing/08/30/p3.recall.idg/index.html CNN.com, 000830

That's it for this week, see you next time.

Andrew King Managing Editor, WebReference.com update@webreference.com

Eric Cook Assistant Editor, WebReference.com ecook@internet.com

Catherine Levy Assistant Editor, WebReference.com clevy@internet.com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For information about advertising in this newsletter, contact Frank Fazio, Director of Inside Sales, Jupitermedia Corp. Call (203)662-2997 or write mailto:ffazio@internet.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This newsletter is published by Jupitermedia Corp. http://internet.com - The Internet Industry Portal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To learn about other free newsletters offered by internet.com or to change your subscription - http://e-newsletters.internet.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ internet.com's network of more than 100 Websites are organized into 14 channels... Internet Technology http://internet.com/sections/it.html E-Commerce/Marketing http://internet.com/sections/marketing.html Web Developer http://internet.com/sections/webdev.html Windows Internet Technology http://internet.com/sections/win.html Linux/Open Source http://internet.com/sections/linux.html Internet Resources http://internet.com/sections/resources.html Internet Lists http://internet.com/sections/lists.html ISP Resources http://internet.com/sections/isp.html Downloads http://internet.com/sections/downloads.html International http://internet.com/sections/international.html Internet News http://internet.com/sections/news.html Internet Investing http://www.internet.com/sections/stocks.html ASP Resources http://internet.com/sections/asp.html Wireless Internet http://internet.com/sections/wireless.html ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To find an answer - http://search.internet.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For information on reprinting or linking to internet.com content: http://internet.com/corporate/permissions.html ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Copyright (c) 2000 Jupitermedia Corp. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~