Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

With the lateste version of ActiveState Perl and IIS 6.0 is CGI implemented as invocing a new process that reads compiles and executes the Perl code on each request of the CGI script? Or is does ActiveState implement a "in process" model that does not have to create a new process to handle the request. I would agree that Perl is powerful. I just want to plan and know how to accomadate a web site that has a high volume of requests? How does CGI handle 1000 request of a cgi script in say a two minute time span? What causes a CGI process to terminate? Can someone direct me to documentation on this. Thank you for your time.

Replies are listed 'Best First'.
Re: Question on Web Server Usage and Perl
by dorward (Curate) on Nov 24, 2005 at 09:38 UTC

    With the lateste version of ActiveState Perl and IIS 6.0 is CGI implemented as invocing a new process that reads compiles and executes the Perl code on each request of the CGI script? Or is does ActiveState implement a "in process" model that does not have to create a new process to handle the request.

    A couple of clicks from the activestate homepage leads me to the ActivePerl Features List, which mentions support for ISAPI under Windows.

    How does CGI handle 1000 request of a cgi script in say a two minute time span?

    By spawning an external program 1000 times. (If you mean how _well_ does it handle it, then that has rather a lot to do with the hardware that its running on, it will handle it a lot better on a system with four AMD 64 processors then it would on the old P75 I have sitting under my desk at home).

    What causes a CGI process to terminate?

    The same thing that causes any process to terminate - typically the script hits an exit() statement or reaches the end of the file.

      thank you for your response. Ive been told by others that ActivePerl's ISAPI extension is my best bet. Maybe Im just inexperienced and uneducated with web server technology. But seems like 4 AMD 64 chips is alot to have to meet those requests. I was think no more then 2 AMD chips ( and not 64 ) with 2GB of ram and a few SCSI OR SATA drives. But Im no system engineer either. Thaks for your reply. I asked the terminate questio because Ive seen snippets implying that perl processes may "hang around" longer then they should.

        seems like 4 AMD 64 chips is alot to have to meet those requests

        That was a system spec I plucked from thin air, simply to provide contrast with the lower end spec. I don't know how much system resources it would take to handle that many requests with CGI. I wouldn't handle it with CGI myself, nor would I use Windows for it, and it would also depend on what the scripts actually did. A script that generates a complex 1600 by 1200 pixel fractal image as an image/png based on user input is going to demand more resources then one which just prints "Hello, world".

        I asked the terminate questio because Ive seen snippets implying that perl processes may "hang around" longer then they should.

        When running under mod_perl, and presumably ISAPI, Perl processes (well, the Perl process is wrapped up inside the Apache process) do hang around once the script has finished executing - then they can be reused for the next request that comes in.