controlling number of perlbal processes

Elliot F elliotf-danga-perlbal at gratuitous.net
Tue May 16 19:34:35 UTC 2006


Mark Smith wrote:
>>What library is causing the fork, and what is the logic behind it?
> 
> 
> What you're seeing is the IO processes that are spawned by
> IO::AIO/Linux::AIO and are used for doing asynchronous IO.  If you don't
> have a need for doing file reading and are going to be generating your
> own content, you can disable that:
> 
> SET aio_mode = none
> 
> (I believe... it's in the manual either way.)  If you have that in your
> config file, then Perlbal would only start up with the one process.

Thank you for the quick reply, but it does not appear to solve the 
problem.  I modified the webserver.conf example configuration file as such:

CREATE SERVICE docs
   SET listen         = 0.0.0.0:80
   SET role           = web_server
   SET docroot        = /usr/share/doc/
   SET dirindexing    = 1
   SET persist_client = on
   server aio_mode       = none
ENABLE docs

# always good to keep an internal management port open:
CREATE SERVICE mgmt
   SET role   = management
   SET listen = 127.0.0.1:60000
   server aio_mode       = none
ENABLE mgmt

Sure enough, perlbal tells me that aio is disabled on start:

$ sudo ./perlbal --config=conf/grat.conf
WARNING:  AIO mode disabled or not available.
           Perlbal will run slowly under load if you're doing any
           disk operations. (e.g. web_server mode).
Running.
beginning run

But it is still running as four processes:

root     11239 24127  6 11:48 pts/2    00:00:00 /usr/bin/perl -w 
./perlbal --config=conf/grat.conf
root     11243 11239  0 11:48 pts/2    00:00:00 /usr/bin/perl -w 
./perlbal --config=conf/grat.conf
root     11244 11239  0 11:48 pts/2    00:00:00 /usr/bin/perl -w 
./perlbal --config=conf/grat.conf
root     11245 11239  0 11:48 pts/2    00:00:00 /usr/bin/perl -w 
./perlbal --config=conf/grat.conf

So I did an strace and found that it's still cloning the process.  I 
looked around and found that I was using Linux::AIO, I removed that and 
started using IO::AIO, and I'm down to one process (for starters):

root     11861 24127  8 11:59 pts/2    00:00:00 /usr/bin/perl -w 
./perlbal --config=conf/grat.conf

So even if it's configured to disabled aio, the process still sucks it 
in (it appears.)

>>The reason why I ask is that I am looking at using perlbal as the basis 
>>of a small perl application server (rather than writing my own from 
>>scratch or using something like POE) for use in memory limited embedded 
>>devices, and having the four processes seems to be unnecessary in my 
>>requirements.
> 
> 
> Sounds interesting.  Good luck.  :)

Thanks, and thanks for the pointer!



More information about the perlbal mailing list