DBus-Daemon Optimizations

Havoc Pennington havoc.pennington at gmail.com
Sun Mar 1 20:38:30 PST 2009


Hi,

On Sun, Mar 1, 2009 at 4:03 PM, Thiago Macieira <thiago at kde.org> wrote:
> 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.
>

I'm pretty sure that isn't *quite* true; in particular I'm not sure
it's right to say it unmarshals and remarshals. It should be getting a
DBusMessage object off the wire and then writing the same DBusMessage
object to the recipient. It's true that it does a fair bit of
validation in converting the incoming bytes to a DBusMessage, but
DBusMessage does store the bytes in marshaled form, so unless
something is broken there should not be an unmarshal/remarshal.

There is some modification of the message (adding more headers, such
as sender) so that could have some cost. One possible optimization is
to have the sender client include the sender header to begin with and
then the bus would just check it. But, doubtful that's a big win.

Bottom line, would need to start with some profiling. Pretty obvious I guess.

Best I remember, the validation and marshaling code just isn't that
fast. I remember more a constant-factor distributed-bloat problem than
a fundamental design problem like extra copies. But, if nobody has
profiled lately, for all we know some really bad f-up has been
introduced in the last few years accidentally. In the past, there have
been things like reparsing /etc/group on every message... you never
know until you profile.

Havoc


More information about the dbus mailing list