Approaches of interprocess communication

Gabriel Genellina gagsl-py at yahoo.com.ar
Fri Feb 16 05:37:45 EST 2007


En Fri, 16 Feb 2007 07:11:36 -0300, exhuma.twn <exhuma at gmail.com> escribió:

> Hi all,
>
> Supposing you have two separate processes running on the same box,
> what approach would you suggest to communicate between those two
> processes.
>
> Let me list the ones I know of:
>
> * Sockets
>    Advantage: Supported per se in nearly every programming language
> without even the need to install additional packages
>    Disadvantage: Lot's of code to write, and it's kind of silly to
> communicate via TCP/IP if the processes run on the same machine.

Not so much code, really.
(And I would expect that making a connection to "localhost" actually does  
*not* go down up to the network card hardware layer, but I don't know for  
real if this is the case or not).

> * Webservices
>    Advantage: Relatively easy to use, can work across different
> languages
>    Disadvantage: Even more overhead on the TCP/IP side that simple
> sockets, as really bulky SOAP messages need to be passed around.

You could use XMLRPC, wich is a lot simpler (but less powerful).

> * CORBA -- similar to webservices but more complicated to code.

I would stay away as far as I could.

> * Shared memory
>   I don't know much about this subject.

You forget the most basic one, stdio redirection. Easy, available on  
almost any language, but limited to just a pair of processes.
You can add queues and messages.

> Supposing both processes are written in Python, is there any other way
> to achieve this? To me, shared memory sound the most suited approach.
> But as said, I am still fuzzy in this area. Where can I find more
> information on this subject?

Pyro appears to be a good alternative (altough I've never used it yet).

-- 
Gabriel Genellina




More information about the Python-list mailing list