Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what dbus performance issue could prevent it from embedded system?

From my reading dbus performance should be twice slower than other messaging ipc mechanisms due to existence of a daemon.

In the discussion of the so question which Linux IPC technique to use someones mention performance issues. Do you see performance issues other than the twice slower factor? Do you see the issue that prevent dbus from being used in embedded system?

To my understanding if dbus is intended for small messages. If large amount of data need to be passed around, one of the solution is to put the data into shared memory or a pile, and then use dbus to notify. Other ipc mechanisms according to the so discussion being in consideration are: Signals, Anonymous Pipes, Named Pipes or FIFOs, SysV Message Queues, POSIX Message Queues, SysV Shared memory, POSIX Shared memory, SysV semaphores, POSIX semaphores, FUTEX locks, File-backed and anonymous shared memory using mmap, UNIX Domain Sockets, Netlink Sockets, Network Sockets, Inotify mechanisms, FUSE subsystem, D-Bus subsystem.

I should mention another so question which lists the requirements (though it is apache centered):

  • packet/message oriented
  • ability to handle both point-to-point and one-to-many communication
  • no hierarchy, there's no server and client
  • if one endpoint crashes, the others must be notified
  • good support from existing Linux distros
  • existence of a "bind" for Apache, for the purpose of creating dynamic pages -- this is too specific though, it can be ignored in a general embedded dbus usage discussion

Yet another so question about performance mentions techniques to improve the performance. With all this being taken care of I guess there should be less issue or drawback when dbus is used in an embedded system.

like image 595
minghua Avatar asked Aug 01 '14 17:08

minghua


People also ask

What is D-Bus used for?

Dbus is an Inter-Process Communication protocol (IPC). It allows multiple processes to exchange information in a standardized way. This is typically used to separate the back end system control from the user-facing interface.

Is D-Bus necessary?

dbus, originally designed as a "Message Bus" is necessary for the system, especially a Desktop system.

What is D-Bus daemon?

D-Bus is first a library that provides one-to-one communication between any two applications; dbus-daemon is an application that uses this library to implement a message bus daemon. Multiple programs connect to the message bus daemon and can exchange messages with one another.

What is org Freedesktop D-Bus?

D-Bus is a message bus system, a simple way for applications to talk to one another.


1 Answers

I don't think there is any real-and-big performance issue.

Did some profiling:

  • On an arm926ejs 200MHz processor, a method call and reply with two uint32 arguments consumes anywhere between 0 to 15 ms. average 6 ms.

  • Changed the 2nd parameter to an array of 1000 bytes. If use the iteration api to pack and unpack the 2nd parameter, it takes about 18 ms.

  • The same 2nd parameter of an array of 1000 bytes. If use the fixed-length api to pack and unpack the 2nd parameter, it takes about 8 ms.

  • As a comparison, use the SysV msgq passing a message to another process and getting a reply. It is about 10 ms too, though without optimizing the code and repeating the test for a large number of samples.

In summary, the profiling does not show a performance issue.

To support this conclusion, there is a performance related page on dbus page, which specifies only the double-context-switching because with dbus it needs to pass the message to the daemon then to the destination.

Edit: If you send messages directly bypassing the daemon, the performance would double.

like image 87
minghua Avatar answered Dec 29 '22 10:12

minghua