Search code examples
windowsperlfastcgipsgi

Persistent, preforked (blocking) Perl web service on Windows


I would like to run a Perl web application on Windows (assume 2008 R2 x64) with reasonable speed / capacity.

Currently my app is based on Mojolicious, using Strawberry Perl and running as CGI through Apache 2.2-win32. With about 20000 lines of code, the creation of the perl process takes a lot of time, almost a second or two while the actually processing is just a blink of a second. I would imagine it to be running much faster and be able to serve much more req/sec if the app is configured in a Fast CGI or persistent style.

If I am on Linux, I would probably have sticked with the PSGI/Plack/Starman and Nginx reverse proxying. Unfortunately, Starman/Starlet does not support Win32.

Morbo/Twiggy does not meet my need because the webapp does block (DB calls) and for some request it does take a while to finish.

So I am looking at Fast CGI solution right now. Unfortunately Apache and mod_fcgid does not work with Perl (Stackoverflow). And I am yet be able to found or work out a compatible binary with mod_fastcgi with 2.4. Something I didn't try yet is mod_fastcgi + Apache 2.2, but I wish I could stay on Apache 2.4.

I am also thinking if I could run my own FCGI process manager (the thing that manage preforking), together with Mojo::Server::FastCGI, and use mod_proxy_fcgi to do reverse proxy instead. Perl module FCGI::ProcManager also does not support Win32. Could there be any other process manager, prehaps in C#? (Preferably in C# for further hacking)

Let me sum up the question -

  • What's the best way to run Perl web app on Windows at a speed much faster than CGI, but not in non-blocking style.
  • and prehaps that lead to a question of - how to make mod_fcgid works with Perl? Or is there any fcgi process manager out there?

Solution

  • You could use the threaded Plack server Thrall.