DBus-Daemon Optimizations
Thiago Macieira
thiago at kde.org
Sun Mar 1 13:03:39 PST 2009
Schmottlach, Glenn wrote:
>I was wondering if the reference DBus Daemon actually
>marshals and unmarshals the messages that pass through it. Does the
>daemon attempt to validate each message that passes through it rather
>than just decoding the message header so it knows where to route the
>message? Any insights into easy optimization approaches would be
>appreciated.
You're correct: the daemon unmarshalls, validates and remarshalls the
messages passing through it. If the incoming message is invalid in any
shape or form, it will disconnect the sender and discard the message.
The rationale is that an invalid message could cause a crash in the
receiver application(s) or worse. Remember that the same D-Bus daemon is
meant to be used in the system bus, where applications can communicate at
different privilege levels.
Also note that the same check is done once again in the receiver
application, to ensure that the message is valid (and since it's the same
library, it's also the same check). The reason there is that the bus could
be a different library or that could be a peer-to-peer connection.
I don't have your device to test with, so the best I can provide is my own
laptop (Linux, Core2 Duo, 1.6 GHz, not fully idle). In that case, my
performance tests give me 713 round-trip method calls in 500 ms where the
call and the reply contain a 1 kB byte-array payload. That's 701 µs/call
in a dual-core system. If I disable one of the cores, I get 683 calls
under the same conditions.
Note that the test includes marshalling and demarshalling the message
entirely, so there's no caching trick.
For comparison, the same code can do 12158 calls in 500 ms if the data
isn't marshalled and sent to another process (the QtDBus loopback call
hack).
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20090301/e3c56b1c/attachment.pgp
More information about the dbus
mailing list