Rip the stuff out of Engine::FastCGI in master
[catagits/Catalyst-Manual.git] / lib / Catalyst / Manual / Deployment / FastCGI.pod
1 =head1 NAME
2
3 Catalyst::Manual::Deployment::FastCGI - Deploying Catalyst with FastCGI
4
5 =head1 FastCGI Deployment
6
7 FastCGI is a high-performance extension to CGI. It is suitable
8 for production environments.
9
10 =head2 Pros
11
12 =head3 Speed
13
14 FastCGI performs equally as well as mod_perl.  Don't let the 'CGI' fool you;
15 your app runs as multiple persistent processes ready to receive connections
16 from the web server.
17
18 =head3 App Server
19
20 When using external FastCGI servers, your application runs as a standalone
21 application server.  It may be restarted independently from the web server.
22 This allows for a more robust environment and faster reload times when
23 pushing new app changes.  The frontend server can even be configured to
24 display a friendly "down for maintenance" page while the application is
25 restarting.
26
27 =head3 Load-balancing
28
29 You can launch your application on multiple backend servers and allow the
30 frontend web server to load-balance between all of them.  And of course, if
31 one goes down, your app continues to run fine.
32
33 =head3 Multiple versions of the same app
34
35 Each FastCGI application is a separate process, so you can run different
36 versions of the same app on a single server.
37
38 =head3 Can run with threaded Apache
39
40 Since your app is not running inside of Apache, the faster mpm_worker module
41 can be used without worrying about the thread safety of your application.
42
43 =head2 Cons
44
45 You may have to disable mod_deflate.  If you experience page hangs with
46 mod_fastcgi then remove deflate.load and deflate.conf from mods-enabled/
47
48 =head3 More complex environment
49
50 With FastCGI, there are more things to monitor and more processes running
51 than when using mod_perl.
52
53 XXX - FIXME, note not just apache!
54
55 =head2 Standalone FastCGI Server
56
57 In server mode the application runs as a standalone server and accepts
58 connections from a web server.  The application can be on the same machine as
59 the web server, on a remote machine, or even on multiple remote machines.
60 Advantages of this method include running the Catalyst application as a
61 different user than the web server, and the ability to set up a scalable
62 server farm.
63
64 To start your application in server mode, install the FCGI::ProcManager
65 module and then use the included fastcgi.pl script.
66
67     $ script/myapp_fastcgi.pl -l /tmp/myapp.socket -n 5
68
69 Command line options for fastcgi.pl include:
70
71     -d -daemon     Daemonize the server.
72     -p -pidfile    Write a pidfile with the pid of the process manager.
73     -l -listen     Listen on a socket path, hostname:port, or :port.
74     -n -nproc      The number of processes started to handle requests.
75
76 See below for the specific web server configurations for using the external
77 server.
78
79 =head1 AUTHORS
80
81 Catalyst Contributors, see Catalyst.pm
82
83 =head1 COPYRIGHT
84
85 This library is free software. You can redistribute it and/or modify it under
86 the same terms as Perl itself.
87
88 =cut
89