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

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

Net::Server::PreForkSimUpsleer(3C)ontributed Perl DocumeNnetta:t:iSoenrver::PreForkSimple(3)

NAME

Net::Server::PreForkSimple - Net::Server personality

SYNOPSIS

use Net::Server::PreForkSimple;

@ISA = qw(Net::Server::PreFork); sub processrequest {

#...code...

}

PACKAGE->run();

DESCRIPTION

Please read the pod on Net::Server first. This module is a personality, or extension, or sub class, of the Net::Server module. This personality binds to one or more ports and then forks "maxservers" child processes. The server will make sure that at any given time there are always "maxservers" available to receive a client request. Each of these children will process up to "maxrequests" client connections. This type is good for a heavily hit site that can keep "maxservers" processes dedicated to the serving. (Multi port accept defaults to 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, Net::Server::PreFork contains several other configurable parameters. Key Value Default 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 maxdequeue \d+ undef checkfordequeue \d+ undef maxservers The maximum number of child servers to start and maintain. This does not apply to dequeue processes. maxrequests The number of client connections to receive before a child terminates. serialize Determines whether the server serializes child connections. Options are undef, flock, semaphore, or pipe. Default is undef. On multiport servers or on servers running on Solaris, the default is flock. The flock option uses blocking exclusive flock on the file specified in lockfile (see below). The semaphore option uses IPC::Semaphore (thanks to Bennett Todd) for giving some sample code. The pipe option reads on a pipe to choose the next. the flock option should be the most bulletproof while the pipe option should be the most portable. (Flock is able to reliquish the block if the process dies between accept on the socket and reading of the

client connection - semaphore and pipe do not)

lockfile Filename to use in flock serialized accept in order to serialize the accept sequece between the children. This will default to a generated temporary filename. If default value is used the lockfile will be removed when the server closes. checkfordead Seconds to wait before checking to see if a child died without letting the parent know. maxdequeue The maximum number of dequeue processes to start. If a value of zero or undef is given, no dequeue processes will be started. The number of running dequeue processes will be checked by the checkfordead variable. checkfordequeue Seconds to wait before forking off a dequeue process. The rundequeue hook must be defined when using this setting. It is intended to use the dequeue process to take care of items such as mail queues. If a value of undef is given, no dequeue processes will be started. 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

maxservers 80 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

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

PPRROOCCEESSSS FFLLOOWW Process flow follows Net::Server until the loop phase. At this point "maxservers" 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 always "maxservers" running. HHOOOOKKSS The PreForkSimple server has the following hooks in addition to the hooks provided by the Net::Server base class. See Net::Server

"$self->childinithook()"

This hook takes place immeditately after the child process forks from the parent and before the child begins accepting connections. It is intended for any addiotional chrooting or other security measures. It is suggested that all perl modules be used by this point, so that the most shared memory possible is used.

"$self->childfinishhook()"

This hook takes place immediately before the child tells the parent that it is exiting. It is intended for saving out logged information or other general cleanup.

"$self->rundequeue()"

This hook only gets called in conjuction with the checkfordequeue setting. 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::PreFork, Net::Server::MultiType, Net::Server::Single Net::Server::SIG Net::Server::Daemonize Net::Server::Proto

perl v5.8.8 2003-03-29 Net::Server::PreForkSimple(3)




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