Choosing an IPC Solution for an Event-Driven Application

I am currently working on a fairly large, single-threaded, event-based application developed under epoll under Linux and comparable technologies on other platforms. Currently, when we want two instances to communicate, they usually do this through sockets, regardless of whether they work on the same computer or not. For performance reasons, I foresee using some form of IPC to speed up the same machine communications. Now I need to decide which IPC mechanism to use.

The following factors are important to me:

  • event-driven, without a complete reorganization - if the IPC mechanism does not fit the era, then months of work are lost for me.
  • fast - if this mechanism is not faster than sockets, it is not worth the time to implement it
  • flexible and (re) configurable at runtime - I believe this excludes MPI and al
  • No multithreading needed.

I am ready to use different mechanisms for different platforms, if they all use the same paradigm. I also want to get as deep as necessary in C / C ++ / Obj-C for platform binding.

Any suggestion?

Thanks.

+4
source share
3 answers

Unix sockets. Named pipes. FIFOs.

They all offer the same basic functionality - the same interprocess communication system. However, implementations have slightly different behavior.

They all use file descriptors, so you can literally just plug them in where your socket used to be.

+3
source

Indeed, as mentioned in skwllsp, AF_INET sockets are optimized for data transfer on the local host, and the speed and complexity are comparable (almost the same?) With fixes, pipes, unix sockets (a lot of skbuff processing is skipped if destination is the same host). my 2 cents is to use sockets. thus, you not only support the same interface for your IPC mechanism, but also successfully use your code for remote and local scripts.

+2
source

Try using Unix SysV IPC. It supports: -

  • message queues
  • Semaphore
  • Common memory

which can help you.

This link may help more: http://www.ibm.com/developerworks/aix/library/au-ipc/index.html

0
source

All Articles