Frage

One of the benefits that's always listed when comparing mod_perl vs. fastcgi, is that for mod_perl you have to completely reload the app and have downtime, but with fastcgi you can reload the app without having downtime. However, I cannot find any examples of how to do this. Is this possible to reload a Catalyst app that's being run using fastcgi without any downtime? I followed this guide to get my Catalyst app up and running. Thanks!

War es hilfreich?

Lösung 2

I was able to create a script that does what I want by combining this guide's script and part of the bash script found in this answer. If you put the script in /etc/init.d and then change the appropriate vars at the top, this script can be pretty useful. Calling:

service script reload

or

/etc/init.d/script reload

Allows you to have no downtime while the new code loads up. The script can be found here. You just need to download the script, change the variables at the top, do

chmod +x script

and move it into /etc/init.d, and then you're good to go! :)

Andere Tipps

Yes. An application running under FastCGI (regardless of whether it uses Catalyst or not) can simply exit; and FastCGI will immediately spawn a replacement process, provided that FastCGI has an AppClass defined for that application and the AppClass is configured with a positive -processes count.

If there is no AppClass or -processes is 0, a replacement process will be created when the next request comes in for the application's URI. This may cause a slight delay for that first request while waiting for the app to start up, but the request will still be handled normally.

In either case, there should be no moment at which an incoming request will be lost or otherwise fail, provided that the application is allowed to exit after completing the current request rather than being interrupted in mid-request (e.g., with kill -9).

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top