Re: [Catalyst] Catalyst on Windows: fork issues
Thanks for all your tips. I will have a look at Apache. It also seems to be quite lightweight and it seems to be better supported under Windows than lighttpd. Rodrigo wrote: Stefan, I've had similar problems in windows with prefork, which can be started up after some tweaking, but will hang after a few requests. Perl's fork() is a no-no in windows. FCGI can be painful to setup, so I ended up giving up on it. I went on to use mod_perl with Apache, which has problems of its own too, but a more trivial setup. Finally, the approach I'm using right now is to setup a pool of single-threaded Catalyst dev servers, starting them up in a startup.bat such as this: start /b perl script\myapp_server.pl -p 3000 start /b perl script\myapp_server.pl -p 3001 start /b perl script\myapp_server.pl -p 3002 ... If you wish to keep all your logs in one place: startup.bat myapp.log 21 Then setup an Apache mod_proxy load-balancer (or lighttpd's, etc.) to balance the load among dev servers. Make sure you understand the drawbacks of using catalyst dev servers in this manner, even though they work superbly. httpd.conf (or apache2.conf or etc.): LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so LoadModule proxy_http_module modules/mod_proxy_http.so Proxy balancer://cat BalancerMember http://localhost:3000 BalancerMember http://localhost:3001 BalancerMember http://localhost:3002 /Proxy ProxyPass / balancer://cat/ ProxyPassReverse / balancer://cat/ Take a look around the web for other settings that you may need, such as catalyst's using_frontend_proxy and apache's static aliases, balancer features, etc. Apache is extremely lightweight if you only run it for reverse proxy load-balancing. If you want to startup your catalyst server pool from a windows service using a configuration file, I have a perl script that does that somewhere. Just let me know. Hope this works for you. --rodrigo ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst on Windows: fork issues
Stefan, I've had similar problems in windows with prefork, which can be started up after some tweaking, but will hang after a few requests. Perl's fork() is a no-no in windows. FCGI can be painful to setup, so I ended up giving up on it. I went on to use mod_perl with Apache, which has problems of its own too, but a more trivial setup. Finally, the approach I'm using right now is to setup a pool of single-threaded Catalyst dev servers, starting them up in a startup.bat such as this: start /b perl script\myapp_server.pl -p 3000 start /b perl script\myapp_server.pl -p 3001 start /b perl script\myapp_server.pl -p 3002 ... If you wish to keep all your logs in one place: startup.bat myapp.log 21 Then setup an Apache mod_proxy load-balancer (or lighttpd's, etc.) to balance the load among dev servers. Make sure you understand the drawbacks of using catalyst dev servers in this manner, even though they work superbly. httpd.conf (or apache2.conf or etc.): LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so LoadModule proxy_http_module modules/mod_proxy_http.so Proxy balancer://cat BalancerMember http://localhost:3000 BalancerMember http://localhost:3001 BalancerMember http://localhost:3002 /Proxy ProxyPass / balancer://cat/ ProxyPassReverse / balancer://cat/ Take a look around the web for other settings that you may need, such as catalyst's using_frontend_proxy and apache's static aliases, balancer features, etc. Apache is extremely lightweight if you only run it for reverse proxy load-balancing. If you want to startup your catalyst server pool from a windows service using a configuration file, I have a perl script that does that somewhere. Just let me know. Hope this works for you. --rodrigo ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst on Windows: fork issues
Good call. Lighttpd will be much simpler than apache, as it's a single standalone executable, just run it with lighttpd -f my_config_file Here's a vbs that will get your .bat file that does all of the jiggery- pokery running without a cmd.exe window at startup. I put everything in %APPLICATION_DATA% except for this start.vbs script which goes in ~/ Startup or whatever the stupid naming convention is in windows. On 27/02/2009, at 10:45 AM, Rodrigo wrote: Stefan, I've had similar problems in windows with prefork, which can be started up after some tweaking, but will hang after a few requests. Perl's fork() is a no-no in windows. FCGI can be painful to setup, so I ended up giving up on it. I went on to use mod_perl with Apache, which has problems of its own too, but a more trivial setup. Finally, the approach I'm using right now is to setup a pool of single-threaded Catalyst dev servers, starting them up in a startup.bat such as this: start /b perl script\myapp_server.pl -p 3000 start /b perl script\myapp_server.pl -p 3001 start /b perl script\myapp_server.pl -p 3002 ... If you wish to keep all your logs in one place: startup.bat myapp.log 21 Then setup an Apache mod_proxy load-balancer (or lighttpd's, etc.) to balance the load among dev servers. Make sure you understand the drawbacks of using catalyst dev servers in this manner, even though they work superbly. httpd.conf (or apache2.conf or etc.): LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so LoadModule proxy_http_module modules/mod_proxy_http.so Proxy balancer://cat BalancerMember http://localhost:3000 BalancerMember http://localhost:3001 BalancerMember http://localhost:3002 /Proxy ProxyPass / balancer://cat/ ProxyPassReverse / balancer://cat/ Take a look around the web for other settings that you may need, such as catalyst's using_frontend_proxy and apache's static aliases, balancer features, etc. Apache is extremely lightweight if you only run it for reverse proxy load-balancing. If you want to startup your catalyst server pool from a windows service using a configuration file, I have a perl script that does that somewhere. Just let me know. Hope this works for you. --rodrigo ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst on Windows: fork issues
Haha, here's the vbs: Set fso = CreateObject(Scripting.FileSystemObject) Set WshShell = CreateObject(WScript.Shell) WshShell.Run chr(34) fso.GetParentFolderName(wscript.ScriptFullName) \perl shell.bat Chr(34), 0 Set WshShell = Nothing And I put a shortcut to this in ~/startup, Shortcut.exe (free download) seems to work. Here's my install.bat script ;) : @echo off set bindir=%~dp0 set bindir=%bindir:~0,-1% mkdir %APPDATA%\MyPersonalHomePage echo ... echo Copying application to hard drive, please be patient xcopy /E /C /Y /Q %bindir% %APPDATA%\MyPersonalHomePage echo ... echo Creating link in startup folder echo ... mkdir %APPDATA%\..\Start Menu\Programs\Startup Shortcut.exe /R:7 /A:C /T:%APPDATA%\MyPersonalHomePage \startmyphp.vbs /F:%AP PDATA%\..\Start Menu\Programs\Startup\Start Personal Home Page Server.lnk %APPDATA%\MyPersonalHomePage\startmyphp.vbs On 27/02/2009, at 10:45 AM, Rodrigo wrote: Stefan, I've had similar problems in windows with prefork, which can be started up after some tweaking, but will hang after a few requests. Perl's fork() is a no-no in windows. FCGI can be painful to setup, so I ended up giving up on it. I went on to use mod_perl with Apache, which has problems of its own too, but a more trivial setup. Finally, the approach I'm using right now is to setup a pool of single-threaded Catalyst dev servers, starting them up in a startup.bat such as this: start /b perl script\myapp_server.pl -p 3000 start /b perl script\myapp_server.pl -p 3001 start /b perl script\myapp_server.pl -p 3002 ... If you wish to keep all your logs in one place: startup.bat myapp.log 21 Then setup an Apache mod_proxy load-balancer (or lighttpd's, etc.) to balance the load among dev servers. Make sure you understand the drawbacks of using catalyst dev servers in this manner, even though they work superbly. httpd.conf (or apache2.conf or etc.): LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so LoadModule proxy_http_module modules/mod_proxy_http.so Proxy balancer://cat BalancerMember http://localhost:3000 BalancerMember http://localhost:3001 BalancerMember http://localhost:3002 /Proxy ProxyPass / balancer://cat/ ProxyPassReverse / balancer://cat/ Take a look around the web for other settings that you may need, such as catalyst's using_frontend_proxy and apache's static aliases, balancer features, etc. Apache is extremely lightweight if you only run it for reverse proxy load-balancing. If you want to startup your catalyst server pool from a windows service using a configuration file, I have a perl script that does that somewhere. Just let me know. Hope this works for you. --rodrigo ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst on Windows: fork issues
And I put a shortcut to this in ~/startup, Shortcut.exe (free download) seems to work. Here's my install.bat script ;) : And here's how to create a shortcut in vbs, so you don't need shortcut.exe: (This creates a link to an access MDE-based app, but the principal applies..) Set oWS = WScript.CreateObject(WScript.Shell) sLinkFile = C:\app.LNK Set oLink = oWS.CreateShortcut(sLinkFile) oLink.TargetPath = C:\Program Files\Microsoft Office\Office\MSAccess.exe oLink.Arguments = /wrkgrp M:\app.mdw C:\app\app.mde oLink.Description = An App oLink.WorkingDirectory = C:\appdir oLink.IconLocation = C:\Program Files\Microsoft Office\Office\MSAccess.exe, 1 oLink.Save - Chris ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/