NAME

FCGI::ProcManager - functions for managing FastCGI applications.

SYNOPSIS

{ # In Object-oriented style. use CGI::Fast; use FCGI::ProcManager; my $proc_manager = FCGI::ProcManager->new({ n_processes => 10 }); $proc_manager->pm_manage(); while (my $cgi = CGI::Fast->new()) { $proc_manager->pm_pre_dispatch(); # ... handle the request here ... $proc_manager->pm_post_dispatch(); }

# This style is also supported:
use CGI::Fast;
use FCGI::ProcManager qw(pm_manage pm_pre_dispatch pm_post_dispatch);
pm_manage( n_processes => 10 );
while (my $cgi = CGI::Fast->new()) {
  pm_pre_dispatch();
  #...
  pm_post_dispatch();
}

DESCRIPTION

FCGI::ProcManager is used to serve as a FastCGI process manager. By re-implementing it in perl, developers can more finely tune performance in their web applications, and can take advantage of copy-on-write semantics prevalent in UNIX kernel process management. The process manager should be invoked before the caller''s request loop

The primary routine, pm_manage, enters a loop in which it maintains a number of FastCGI servers (via fork(2)), and which reaps those servers when they die (via wait(2)).

pm_manage provides too hooks:

C<managing_init> - called just before the manager enters the manager loop.
C<handling_init> - called just before a server is returns from C<pm_manage>

It is necessary for the caller, when implementing its request loop, to insert a call to pm_pre_dispatch at the top of the loop, and then 7pm_post_dispatch at the end of the loop.

METHODS

new

Manager methods

pm_manage

global
() pm_manage(int processes_to_spawn)

DESCRIPTION:

When this is called by a FastCGI script to manage application servers.

managing_init

pm_die

pm_reap_server

pm_write_pid_file

pm_remove_pid_file

sig_manager

Handler methods

handling_init

pm_pre_dispatch

pm_post_dispatch

sig_handler

Common methods and routines

self_or_default

private global
(ProcManager, @args) self_or_default([ ProcManager, ] @args);

DESCRIPTION:

This is a helper subroutine to acquire or otherwise create a singleton default object if one is not passed in, e.g., a method call.

pm_change_process_name

pm_received_signal

pm_parameter

n_processes

no_signals

pid_fname

die_timeout

role

start_delay

pm_warn

pm_notify

exit

pm_abort

BUGS

No known bugs, but this does not mean no bugs exist.

SEE ALSO

FCGI.

COPYRIGHT

FCGI-ProcManager - A Perl FCGI Process Manager
Copyright (c) 2000, FundsXpress Financial Network, Inc.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

BECAUSE THIS LIBRARY IS LICENSED FREE OF CHARGE, THIS LIBRARY IS
BEING PROVIDED "AS IS WITH ALL FAULTS," WITHOUT ANY WARRANTIES
OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT
LIMITATION, ANY IMPLIED WARRANTIES OF TITLE, NONINFRINGEMENT,
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, AND THE
ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY,
AND EFFORT IS WITH THE YOU.  See the GNU Lesser General Public
License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA