simple and fast platform independent IPC

Joan Miller peloko45 at gmail.com
Wed Feb 3 05:39:58 EST 2010


On 3 feb, 09:34, Vinay Sajip <vinay_sa... at yahoo.co.uk> wrote:
> On Feb 3, 8:32 am, News123 <news... at free.fr> wrote:
>
>
>
> > Hi,
>
> > I wondered what IPC library might be best simplest for following task?
>
> > I'm having a few python scripts all running on the same host (linux or
> > win), which are started manually in random order. (no common parent process)
> > Each process might be identified by an integer (1,2,3) or by a symbolic
> > name ( 'dad' , 'mom' , 'dog' )
>
> > these scripts want to send short messages to each other ( mostly
> > integers, max a few bytes, short string), which would be enqueued in
> > message queues of the receiving process.
>
> > example:
>
> > 'dad' wants to tell 'mom': 'cook'
> > 'dog' wants to tell 'dad' : 'feedme'
> > 'mom' wants to tell 'dad' : 'cookyourself'
>
> > the receiver dos not necesarily have to know who sent the message
>
> > a message shall be dropped silently if the receiving process is not running
>
> > a message shall be reliably delivered if the receiving process is up
>
> > xmlrpc seems to be a little heavy for such tasks.
>
> > signals don't allow to exchange data
>
> > a shared memory message queue would probably a good solution, but
> > python's Multiprocessing.Queue  seems to require a common parent process
>
> > thanks a lot for any ideas / suggestions
>
> > N
>
> > N
>
> Gabriel's suggestion is very good; if you need something which is a
> little more like RPC but still quite lightweight, consider Pyro
> (http://pyro.sourceforge.net/)
>
> Regards,
>
> Vinay Sajip

I've read that Pyro is not safe. Anyway, you have in mind that respect
to speed:

shared memory > named pipes > Unix domain socket > TCP socket

I don't sure about if the message queues would be faster that Unix
domain sockets

Another thing. Using shared memory would be as to use a single thread
but using message queues would be as multiple-threading.



More information about the Python-list mailing list