Efficient Python IPC

Wojciech Danilo picture Wojciech Danilo · Feb 2, 2013 · Viewed 8.1k times · Source

I'm making an application in Python3, which will be divided in batch and gui parts. Batch is responsible for processing logic and gui is responsible for displaying it.

Which inter-process communication (IPC) framework should I use with the following requirements:

  1. The GUI can be run on other device than batch (GUI can be run on the same device, on smartphone, tablet etc, locally or over network).
  2. The batch (Python3 IPc library) should work with no problem on Linux, Mac, Windows, ...
  3. The IPC should support GUI written in different languages (Python, Javascript, ...)
  4. The performance of IPC is important - it should be as "interactive" as possible, but without losing information.
  5. Several GUI could be connected to the same batch.

additional: Will the choice be other if the GUI will be guaranteed to be written in Python also?

Edit: I have found a lot of IPC libraries, like here: Efficient Python to Python IPC or ActiveMQ or RabbitMQ or ZeroMQ or.

The best looking options I have found so far are:

  • rabbitmq
  • zeromq
  • pyro

Are they appropriate slutions to this problem? If not why? And if something is better, please tell me why also.

Answer

Jonathan picture Jonathan · Feb 2, 2013

The three you mentioned seem a good fit and will uphold your requirements. I think you should go on with what you feel most comfortable\familiar with.

From my personal experience, I do believe ZeroMQ is the best combination between efficiency, ease of use and inter-operability. I had an easy time integrating zmq 2.2 with Python 2.7, so that would be my personal favorite. However as I said I'm quite sure you can't go wrong with all 3 frameworks.

Half related: Requirements tend to change with time, you may decide to switch framework later on, therefore encapsulating the dependency on the framework would be a good design pattern to use. (e.g. having a single conduit module that interacts with the framework and have its API use your internal datastructures and domain language)