Hi,

I am in the process of writing an application which is a central
manager which should do a lot of IPC with databases, worker processes
(already written in C, receiving commands via UNIX sockets), and user
control via another UNIX socket.

Initially I tried using nonblocking IO, but I found a lot of headaches
finding out the state of the different filehandles (I think they
aren't well suited for nonblocking IO). The next step would be to use
select loop and low-level IO, but it scared me a bit :)

Also I tried POE, but didn't have nothing near good performance.

Then threads came as a natural solution as I could have different subs
doing blocking IO without worring (a similar approach I used for the
workers, many of them blocking, not consuming CPU and being very tiny
in size). But then I found out the new ithreads, which seem to me
unacceptably big, but since I will use just 4 or 5, I can cope with
that.

My first problem is, I don't understand yet the inner workings, and
I've seen different behaviors in debian sarge and woody; but the most
troubling thigs is I find dead IPC shared memory blocks which
sometimes I can't even free with ipcrm!!

I don't understand why use IPC in the first place, there isn't any
option to use real shared memory (they are threads!), or
shm_open+mmap? (not sure if it is possible under perl)

Also, I found today the Elizabeth Mattijsen's forks.pm module, and
read that it uses TCP communication (why not UNIX, or -again- mmap?).
Anyway, that seems to me the best approach, as it would be lighter
than ithreads, and I just need to pass messages and a couple of shared
variables across threads.

I read a little of the code but couldn't understand anything :). I'm
very worried about performance issues, and some hints would be useful
before deciding what to use for the project.

Having spent many hours trying to figure out what to do, there is very
little stopping me from trying a complete C solution, but that would
be painful! Please, give me some hints so I can still be a lazy perl
lover :)

Thanks a lot for your time!

-- 
Martín Ferrari

Reply via email to