http://www.perlmonks.org?node_id=645877

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

Hi All,
  After my "Brown trousers" post I've been looking into FastCGI a lot. Seeing that it works with lots of different servers and not just apache was very attractive (sorry mod_perl). Also one of the big things was seeing that Microsoft (as much as I dislike em) have embraced FastCGI and released their own library for IIS 5.1 and IIS6. Further more IIS7 on Windows 2008 (I've been testing RC0) comes with their FastCGI library as standard. Wicked :)

Just one drawback, Microsoft has been working with Zend (yes the PHP guys) to release this FastCGI library, and they tell you exactly how it can work with PHP. They go on to say it'll work with other languages... but they don't really know how. Bummer. Looking through the forums I saw a guy "Andrew Sears" trying to get it working with Ruby on Rails, he also gave me a great deal of help, putting me on the right track when I posted about getting it working with Perl. The only other post about Perl and their FastCGI was a guy complaining that he wanted a guide...

So me decided to get it working miself...

Now I've released FCGI::IIS on CPAN, 3rd revision so far.

I've got it working on Windows 2003, and Windows 2008. Vista IIS7 is pending an update from Microsoft for me to be able to try it out.

It's working (mostly) for perl scripts that want to run a bit faster on IIS using FastCGI (no FastCGI code needed in the actual scripts, so this should work with almost any windows compatible perl script) I've not put together a guide for running your Perl FastCGI scripts in their own application pool... yet...

Either way, I'm quite chuffed with it. Looking at the code of the module, it looks like hardly anything, but figuring it all out and testing it has taken ages.

I'm interested in any feedback...


Lyle
  • Comment on FastCGi on IIS... The tale of Microsoft and my new Perl Module...

Replies are listed 'Best First'.
Re: FastCGi on IIS... The tale of Microsoft and my new Perl Module...
by perrin (Chancellor) on Oct 19, 2007 at 03:08 UTC
    Got any benchmarks vs. CGI on the same IIS server?
      I'll be benchmarking it soon. Wanted to iron out as many bugs as possible first.

      Lyle
Re: FastCGi on IIS... The tale of Microsoft and my new Perl Module...
by adrianh (Chancellor) on Oct 19, 2007 at 11:40 UTC

    Erm.

    • Doesn't FCGI already work on IIS? There are certainly passes on WIn32 on cpantesters.
    • You seem to be compiling the script every time - which sort of defeats the object of the exercise?
      Things may have changed, but I know that a few years back when I needed to run some perl stuff on an existing IIS server and went looking for a FastCGI plugin, there was nothing available. I asked around and found only a few incomplete personal projects. So, given that PerlEx is no longer available, I think this is a big deal for people stuck on IIS.
        Why another fastcgi module? FCGI is working perfectly on windows (with the new fastcgi implementation for iis 5 and 6). You can't just pick a random cgi script and expect it to work with fastcgi - it's not possible. Apache::Registry was designed to do this, it has been improved for years and it still has some special cases.

        BTW, PerlEx is available and comes bundled with the ActivePerl disto. PerlEx is now free as ActivePerl.

        BTW2, if you are going to use fastcgi on windows make sure to compile your own perl with ITHREADS disabled. They are useless with fastcgi and you will gain about 20% boost in performance. ActivePerl has ITHREADS enabled.
      This module is designed to be a drop in replacement for using CGI, you are getting some benefits of FastCGI, reusing processes rather than making new ones, and the perl interpreter is already loaded.

      Any Perl CGI script should be able to use this module, without any specific FastCGI coding or adjustments. Of course scripts coded in FastCGI will work as normal without this module.

      Lyle
        Any Perl CGI script should be able to use this module, without any specific FastCGI coding or adjustments.

        I can tell you right away that it won't work perfectly. What you're doing is mostly the same as what Apache::Registry does. If someone defines a global, it will still be there the next time the script is run. If they load a module, it will still be there, and it will not reload even if they change the module. There's a lot of mod_perl documentation discussing these issues and how to cope with them.

A reply falls below the community's threshold of quality. You may see it by logging in.