Re: multi-processes

Bill Snapper (snapper@openmarket.com)
Wed, 11 Sep 1996 21:14:24 -0300

Message-Id: <323755E0.1C26@openmarket.com>
Date: Wed, 11 Sep 1996 21:14:24 -0300
From: Bill Snapper <snapper@openmarket.com>
To: Roger Day <roger@ssynth.co.uk>
Subject: Re: multi-processes

Roger Day wrote:
> 
> Hi,
> 
> having compiling and run everything...it works just fine and handsome.
> 
> There is one question: each registered app can have as many pre-forked processes
> as you wish.
> 
> My question is...why? I can understand one, but if you try the tiny-perl-fcgi
> with two processes you get this on subsequent calls to the same script
> 
> 1 1
> 2 2
> 3 3
> 4 4
> 	Roger, the reason you're seeing this is that while there are
two processes running, they're both doing the same thing.  There's
no state shared between the processes.  Each process is blocking on
a FCGI_Accept call and when you hit the URL that defines it, you get one
of the processes.  A subsequent hit will cause the other process to 
accept the next connection and therefore process the request, and so on.

	The reason you would want multiple processes running and 
listening on the same port is load driven.  If you have a FastCGI 
application which needs to support lots of requests and you don't want
requests blocking, you can add more processes so that multiple requests
can run concurrently.  If you onle define a single FastCGI process
with the example you've described, you can only run one request at a
time regardless of the number of httpd listener processes you have 
running.

	Hope this helps,

	   - Bill -

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Bill Snapper           | Open Market, Inc.   | My opinions are my own,
Software Engineer      | 245 First St.       | and not necessarily
snapper@openmarket.com | Cambridge, MA 02142 | those of my employer, 
1-617-374-6501         |                     | Open Market Inc.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++