Re: SMP: inter-process communication

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Tue, 23 Feb 2010 09:33:13 -0700

On 02/23/2010 04:30 AM, Tsantilas Christos wrote:
> - master process communicates with one direction pipes with kids, sending
> various commands
...
> Master/kids communication using pipes is used by the apache worker server.
> I am also using it in my icap server. I am not seeing any problem.

I would prefer to have a single IPC mechanism. The parent/kid pipe is a
candidate.

Here are the properties for the "ideal" IPC mechanism:

1) Can be used to pass descriptors among processes (so that two kids can
listen on the same port and so that we can implement acceptor/worker
design if we want to).

2) Can be used to access any squidN process (to get hits from future
cacheN processes and to implement multiple acceptors/workers design if
we want to).

3) Is based on select(2)-able descriptors.

4) Can be ported to or emulated on Windows and other corner-case OSes.

If I missed any, please add.

Let's evaluate the "parent/kid pipes" IPC:

Property1 can be satisfied due to fork() side-effects. However, this
restricts descriptor sharing or exchange to parent/kid relationship. You
cannot share or exchange descriptors among siblings.

Property2 cannot be satisfied directly but can be emulated by kids
sending the command to the parent and the parent routing/relaying the
command to the other kid.

Property3 is satisfied.

Property3 can be satisfied, I guess, but some emulation may be necessary.

Here is a similar evaluation for Unix domain sockets:

Property1 is satisfied.
Property2 is satisfied.
Property3 is satisfied.
Property4 can be satisfied but only with emulation using
Windows-specific IPC mechanisms.

So, neither parent/kid pipe nor UDS is ideal. Both are candidates. I
lean towards UDS because they make communication between kids or even
unrelated processes possible. I am worried about restricting all
communications to communication with a parent.

What do you think?

Thank you,

Alex.
P.S. To have multiple processes, we will need to fork one way or the
other. Some IPCs (e.g., parent/kid pipes) may dictate certain forking
methods. A forking daemon suggested by Robert sounds like a good
optimization.
Received on Tue Feb 23 2010 - 16:33:37 MST

This archive was generated by hypermail 2.2.0 : Tue Feb 23 2010 - 12:00:09 MST