About performance of D-Bus

tian tian mr.zoufeng at gmail.com
Thu Oct 25 00:09:47 PDT 2007


Hi,

    I want to use D-Bus as communication mechanism between processes. But I
am not sure if it can work effectually on my PXA310(ARM, about 600MHz), so I
did some performance test as follows:
1.
    Use socket to carry data form a process(client) to another
process(server):
        client.c:
            gettimeofday()
            write() /* write 100 bytes data */
        server.c:
            read() /* read 100 bytes data */
            gettimeofday()
    The interval between the two gettimeofday() is about 180 microseconds.

2.
    Use D-Bus(Ver 1.0.2) to do a remote method call(peer-to-peer):
        client.c:
            main()
            {
                dbus_connection_open (CONNECTION_ADDRESS, &error);

                dbus_message_new_method_call()
                dbus_connection_send_with_reply_and_block()

                gettimeofday()
                dbus_message_new_method_call()
                dbus_message_append_args() /* append 100 bytes data as input
parameter */
                dbus_connection_send_with_reply_and_block() /* */
                dbus_message_get_args() /* it will get 100 bytes data as
output parameter */
                gettimeofday()
            }
        server.c:
            main()
            {
                server = dbus_server_listen (CONNECTION_ADDRESS, &error);
                dbus_server_setup_with_g_main (server, NULL);
                dbus_server_set_new_connection_function (server,
new_connection_func, NULL, NULL);
                g_main_loop_run()
            }
            new_connection_func()
            {
                server_conn_ptr = dbus_connection_ref (conn);
                dbus_connection_setup_with_g_main( server_conn_ptr, NULL );
                dbus_connection_add_filter( server_conn_ptr, dbus_filter,
loop, NULL );
            }
            dbus_filter()
            {
                /* handle & response the remote method call */
            }
    The interval between the two gettimeofday() is about 4200 microseconds!
(I tried about ten thousands, the value is quite consistent)

    As you can see, compared with socket, D-Bus is much slower. But the FAQ
says D-Bus one-to-one communication was about 2.5x slower than simply
pushing the data raw over a socket. So there must be some mistakes in my
test program. I hope someone can help me. Many thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20071025/6b06ffa1/attachment-0001.htm 


More information about the dbus mailing list