Manual Pages for UNIX Darwin command on man Net::Server::PreFork
MyWebUniversity

Manual Pages for UNIX Darwin command on man Net::Server::PreFork

Net::Server::PreFork(3)User Contributed Perl DocumentatioNnet::Server::PreFork(3)

NAME

Net::Server::PreFork - Net::Server personality

SYNOPSIS

use Net::Server::PreFork;

@ISA = qw(Net::Server::PreFork);

sub processrequest {

#...code...

}

PACKAGE->run();

DESCRIPTION

Please read the pod on Net::Server and Net::Server::PreForkSimple

first. This module is a personality, or extension, or sub class, of

the Net::Server::PreForkSimple class which is a sub class of

Net::Server. See Net::Server::PreForkSimple.

This personality binds to one or more ports and then forks "minservers" child process. The server will make sure that at any given time there are "minspareservers" available to receive a client request, up to "maxservers". Each of these children will process up to "maxrequests" client connections. This type is good for a heavily hit site, and should scale well for most applications. (Multi port accept is accomplished using flock to serialize the children). SSAAMMPPLLEE CCOODDEE Please see the sample listed in Net::Server. CCOOMMMMAANNDD LLIINNEE AARRGGUUMMEENNTTSS In addition to the command line arguments of the Net::Server base class

and the Net::Server::PreForkSimple parent class, Net::Server::PreFork

contains several other configurable parameters. You really should also

see Net::Server::PreForkSimple.

Key Value Default minservers \d+ 5 minspareservers \d+ 2 maxspareservers \d+ 10 maxservers \d+ 50 maxrequests \d+ 1000 serialize (flock|semaphore|pipe) undef

# serialize defaults to flock on multiport or on Solaris

lockfile "filename" POSIX::tmpnam checkfordead \d+ 30 checkforwaiting \d+ 10 maxdequeue \d+ undef checkfordequeue \d+ undef childcommunication 1 undef minservers The minimum number of servers to keep running. minspareservers The minimum number of servers to have waiting for requests. Minimum and maximum numbers should not be set to close to each other or the server will fork and kill children too often. maxspareservers The maximum number of servers to have waiting for requests. See minspareservers. maxservers The maximum number of child servers to start. This does not apply to dequeue processes. checkforwaiting Seconds to wait before checking to see if we can kill off some waiting servers. childcommunication Enable child communication to parent via unix sockets. If set to true, will let children write to the socket contained in

$self->{server}->{parentsock}. The parent will be notified

through childistalkinghook where the first argument is the socket to the child. The child's socket is stored in

$self->{server}->{children}->{$childpid}->{sock}.

CCOONNFFIIGGUURRAATTIIOONN FFIILLEE

"Net::Server::PreFork" allows for the use of a configuration file to

read in server parameters. The format of this conf file is simple key value pairs. Comments and white space are ignored.

#------- file test.conf -------

### server information

minservers 20 maxservers 80 minspareservers 10 minspareservers 15 maxrequests 1000

### user and group to become

user somebody group everybody

### logging ?

logfile /var/log/server.log loglevel 3 pidfile /tmp/server.pid

### access control

allow .+\.(net|com) allow domain\.com deny a.+

### background the process?

background 1

### ports to bind

host 127.0.0.1 port localhost:20204 port 20205

### reverse lookups ?

# reverselookups on

### enable child communication ?

# childcommunication

#------- file test.conf -------

PPRROOCCEESSSS FFLLOOWW Process flow follows Net::Server until the loop phase. At this point "minservers" are forked and wait for connections. When a child accepts a connection, finishs processing a client, or exits, it relays that information to the parent, which keeps track and makes sure there are enough children to fulfill "minservers", "minspareservers", "maxspareservers", and "maxservers". HHOOOOKKSS The PreFork server has the following hooks in addition to the hooks

provided by PreForkSimple. See Net::Server::PreForkSimple.

"$self->parentreadhook()"

This hook occurs any time that the parent reads information from the child. The line from the child is sent as an argument.

"$self->childistalkinghook()"

This hook occurs if childcommunication is true and the child has

written to $self->{server}->{parentsock}. The first argument will

be the open socket to the child. TTOO DDOO See Net::Server AUTHOR Paul T. Seamons paul@seamons.com TTHHAANNKKSS See Net::Server

SEE ALSO

Please see also Net::Server::Fork, Net::Server::INET,

Net::Server::PreForkSimple, Net::Server::MultiType, Net::Server::Single

Net::Server::SIG Net::Server::Daemonize Net::Server::Proto

perl v5.8.8 2004-02-14 Net::Server::PreFork(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™