6

I need an IPC system on Linux. My requirements are:

  1. packet/message oriented
  2. ability to handle both point-to-point and one-to-many communication
  3. no hierarchy, there's no server and client
  4. if one endpoint crashes, the others must be notified
  5. good support from existing Linux distros
  6. existence of a "bind" for Apache, for the purpose of creating dynamic pages

sorted in order of importance (roughly). I don't need extreme performance, nor I will be sending high volume of data.

I stumbled upon DBus, and it looks like a good candidate (it pecl::packages::dbus a good mechanism to let Apache access the DBUS?). But before diving deep in DBus documentation I'd like to hear some suggestions.

Lorenzo Pistone
  • 5,028
  • 3
  • 34
  • 65
  • The answer: Yes. dbus meets those requirements. – Vanwaril May 06 '12 at 20:34
  • I don't understand what you mean by Apache bindings. These platforms/libraries/solutions are almost always independent of Apache. – Mahmoud Al-Qudsi May 07 '12 at 16:56
  • @MahmoudAl-Qudsi I mean, I want to be able to gather informations from this communication system and generate webpages on demand from within apache, in an easy way. I have no experience with any framework of the web, so I have no preference in what I should learn. but I need a stable and common (among linux distros) library, because the project is intended to be used by others. For this same reason I suppose that I will be using apache, because I guess that it's the most widespread web server in the linux area. – Lorenzo Pistone May 07 '12 at 20:20
  • You're confusing the purpose of a webserver with the purpose of the scripts it'll run. – Mahmoud Al-Qudsi May 07 '12 at 20:47

1 Answers1

8

ZeroMQ provides all the features you ask for and then some. It's basically a "work no matter what" messaging system that'll take care of all the corner cases and subtleties in IPC messaging.

However, ZMQ and all the others like it are not applications - they're APIs you can use to create applications with. You would use ZMQ from whatever script your Apache is running (eg PHP backend).

Mahmoud Al-Qudsi
  • 28,357
  • 12
  • 85
  • 125
  • what is worrying me is, do I have to create my own parser in PHP for the zmq own protocol, or are there already bindings? – Lorenzo Pistone May 07 '12 at 20:34
  • Nevermind, I just came across a PHP example in zmq website :D – Lorenzo Pistone May 07 '12 at 20:42
  • Point 4 is missing: "At this time, none of the sockets will provide notification of peer connect/disconnect" – Lorenzo Pistone May 07 '12 at 20:46
  • You can implement that yourself easily enough with a "ping" message - there are many reasons why 0mq doesn't do this out of the box, mainly because the definition of "disconnect" is very much case-specific. If you post a question on SO about a good way of pulling that off, you'll get responses. (or, better yet, better alternatives than disconnect notification) – Mahmoud Al-Qudsi May 07 '12 at 20:51
  • You have to definitively use ZeroMQ, because it is much more easy to handle and to customize with Apache and PHP. Use D-Bus only if you don't have the choice (trus me) – Epoc Aug 03 '14 at 21:18