in reply to Re: Fast CGI
in thread Fast CGI

By the way, what is the difference between mod_perl and fastCGI ? I mean I know how mod_perl works, but how does FastCGI? What are the differences ?

Replies are listed 'Best First'.
Re: Re: Re: Fast CGI
by IlyaM (Parson) on Oct 21, 2002 at 12:06 UTC
    mod_perl lets you to embed Perl interpretator in Apache. FastCGI allows to run any application as a daemon which communicates with web server. Main differences (beware that I don't use FastCGI myself and run my web programms under mod_perl so I can be wrong in some details):
    1. mod_perl is highly coupled with Apache and gives your Perl applications access to its internals what impossible with FastCGI
    2. mod_perl is for Apache only. FastCGI supports other web servers as well
    3. mod_perl is for Perl only. FastCGI is not limited to Perl
    4. Since FastCGI runs your program as a separate daemon it can run under different UID/GID than web server. FastCGI may be more flexiable when it comes to dealing with security polices.
    5. Probably other things I forgot to mention or I don't know.
    Personally I prefer mod_perl (mostly because of #1).

    --
    Ilya Martynov, ilya@iponweb.net
    CTO IPonWEB (UK) Ltd
    Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net
    Personal website - http://martynov.org

      In addition to the things IlyaM mentions, I'd add,

      6. FastCGI processes can run on a separate computer from the web server.
      All FastCGI does it take an HTTP request and send it, with appropriate delimiters, to another socket and then wait for a response. What makes it fast is that you can then structure your program like this:
      Initialization ... while (new CGI::Fast) { main CGI loop }
      You can thus service many requests without the all the overhead of process start-up, Perl compilation, DB opens, etc. Except for separating the initialization code, FastCGI usually doesn't require any changes to your program. You often do have to make some more changes for mod_perl, although usually not much.