Regarding Performance of DBUS library

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Aug 29 07:26:54 PDT 2012


On 29/08/12 14:05, rajnikant jachak wrote:
> As I said, my client emits 'req' signal and server processes it. In my
> system, there would be multiple clients emitting same signal 'req',
> which server in turn needs to process.

That's fine. Multiple client processes are fine, multiple threads within
one process are more problematic (because they share an address space,
so they need mutexes and very careful programming practices).

> Would such type of many to one association, overload DBUS?

Many-to-one communication is fine - it's a large part of why D-Bus
exists. But you're asking about performance without giving any
indication of what you're actually doing, so I should give you the usual
performance advice.

The standard D-Bus system and session buses are really designed to be
used for "signalling" - individual messages or short bursts of messages
when something interesting happens - rather than for continuous bulk
traffic. For instance, it's ideal for something like NetworkManager.
When the user takes action or "interesting" things happen in the real
world (network cable plugged in, wireless network detected, etc.),
relatively many messages are sent, but that's a temporary situation.
When the computer is idle, NetworkManager only needs to send a message
to the UI every few seconds (or even every few minutes) to say "signal
strength has changed to 42%" or similar.

Similarly, the Telepathy IM framework sends D-Bus messages when you send
or receive messages, start or receive calls, or when your friends'
presence statuses change, but in between "interesting" events, it's
idle. That's the sort of thing D-Bus is meant for.

My usual rule of thumb is that if you have to worry about D-Bus'
performance or what percentage of CPU time it will take up, you should
consider whether D-Bus is actually the right thing for you. You can
always use the system bus to do the "handshaking" for a private Unix
socket or something, then do your bulk data transfer over that.

If you tell this mailing list what your use case is, we're more likely
to be able to say whether D-Bus is appropriate. Otherwise, the only
answer you're likely to get is "it depends".

If yes, would
> such problem get resolved if every client emits different signal (ex.
> client1 emits req1, client2 emits req2 etc) for server?

No, renaming messages does not alter the amount of CPU time they'll require.

    S


More information about the dbus mailing list