About performance of D-Bus

Rob Taylor rob.taylor at codethink.co.uk
Thu Oct 25 01:17:17 PDT 2007


You're not comparing like with like - The 2nd case would be more like
the first if you print the gettimeofday in the the dbus_filter function.
Could you do this and see how that compares? Also make sure the first
case is using a select rather than a blocking read and that there's no
other processes running for good reproducibility.

Thanks,
Rob Taylor

tian tian wrote:
> 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!
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus


-- 
Rob Taylor, Codethink Ltd. -  http://codethink.co.uk


More information about the dbus mailing list