About performance of D-Bus

Kalle Vahlman kalle.vahlman at gmail.com
Tue Jun 10 22:30:25 PDT 2008


2007/10/25 Havoc Pennington <hp at redhat.com>:
> Hi,
>
> Kalle Vahlman wrote:
>>
>> I'm not sure if the D-Bus daemon already has such logging facilities,
>> but storing information on the amount of messages, average/peak sizes
>> of payloads and identifying who sends how much during regural daily
>> usage should be very interesting to chart.
>>
>
> Indeed. This is most likely very simple: an easy approach would be to hack
> the daemon to send a signal message out whenever the data changes, then have
> a little app that connects to dbus and gets these messages. The only trick
> is, don't count the signals themselves ;-)

This has been sitting in my inbox as a TODO for quite some time and
few weeks ago I went ahead and hacked something up. Then got busy etc.
but now the code is available at

  http://gitweb.pingu.fi/?p=dbus.git;a=summary

There's two new things in the repo (both controlled by the --enable
option for configure):

In libdbus there now is a trivial traffic logging support by recording
data from DBusMessages into a file. This is public API with log domain
support so you could use it in whatever application you want to for
recording messages for traffic profiling.

And then there's the dbus-daemon portion which records all outgoing
messages using the above system. I decided that this would be the most
interesting data to start with, as it includes _all_ delivered
messages even when there are multiple recipients. Of course it doesn't
record the incoming messages that don't have a recipient but that's
for another day.

The data recorded is as follows:

domain ; sender ; destination ; message type ; signature ; size(bytes)
; sha-1  of message body ; message timestamp (seconds from epoch)

Obviously, this means sha-1 calculations for each message recorded as
well as disc access so it definitely will degrade performance :) The
uniqueness of a message is an important factor though, so I think it
is worth it. It's not like this code is intended to run on production
systems anyway ;)

The profiling has two enviromental variables:
 - DBUS_TRAFFIC_PROFILING for enabling/disabling the profiling (set/unset)
 - DBUS_TRAFFIC_PROFILING_LOG for controlling where to write the file

Let me know if I've done something silly in the code. I've been
running it on my N800 for a while and last night set up my desktop
machine to do the same, so at least it works to some degree.

Haven't had time to really analyze the data, but seems like the
average message size (in system bus at least) is pretty small and the
bus is not so active as one might think given the impression that
"everything" uses D-Bus. There were some peaks though and seems like
the system bus is more active so it should be interesting to see what
happens there too.

-- 
Kalle Vahlman, zuh at iki.fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi


More information about the dbus mailing list