6

I am working in a Linux based embedded project with C/C++ and python applications. And we need an Inter Process Communication (IPC) method to transport JSON based messages between those applications. Initially DBus was an obvious option since it is present in almost all Linux distributions and is quite stable and proved software. Also there are libraries for many programming languages. Also DBus has a very granular and nice permission system - which is a requirement for our project (security reasons).

But unfortunately we have experienced some drawbacks of DBus:

  1. We have hit some stability bugs like in some specific congestion situations there were some memory leaks which lead to dead IPC and only application restart helped.
  2. Only the usage of DBus introduced 3-5 MB of ram usage per each application (which on a system with 512 MB RAM and multiplied by 25 applications does make some room for improvements).
  3. The data flow model (signals / methods) seem to be a bit too complicated for the use-case we need.

Our next idea is to switch to some of Message broker available. But we also look for some nice to have features:

  1. Be able to broadcast or Multicast messages to multiple applications
  2. To have presence of applications when they connect/disconnect from the bus-server (the server can broadcast when new applications connect and when applications disconnect).
  3. Watchdog of connected applications. Sometimes the apps might behave wrong on the IPC (by not answering to IPC messages) and the server with watchdog could detect that and disconnect that application and inform others that the application is dead.

How do we avoid DBus in this scenario?

jww
  • 97,681
  • 90
  • 411
  • 885
Gheorghe
  • 61
  • 1
  • 3
  • You haven't described your requirements well enough. An alternative to DBus with respect to what? On of the key things DBus offers over other conventional UNIX IPC is service discovery. I.e. some third party app developed by some other person you've never met can hit up your API. If you don't need that then there is plenty of alternatives. If you do then it's another question. – spinkus Nov 23 '19 at 22:06
  • I think this question should be moved to Super User. – dan1st Nov 23 '19 at 22:16
  • 1
    There are lots of IPC alternatives on Linux. Socket, shared memory, message queues. Maybe you can try [`mq_overview`](http://man7.org/linux/man-pages/man7/mq_overview.7.html) and see if it fits your needs. If the messages need formatting, then see something like [bson](http://bsonspec.org/) or [protocol buffers](https://developers.google.com/protocol-buffers). – jww Nov 23 '19 at 22:16
  • we're looking at ubus – jerrylogansquare Feb 08 '22 at 22:17

0 Answers0