Re: [systemd-devel] sd-bus vs gdbus on dbus-daemon

2015-05-01 Thread Umut Tezduyar Lindskog
On Thu, Apr 30, 2015 at 11:13 AM, Umut Tezduyar Lindskog
u...@tezduyar.com wrote:
 Hi Simon,

 On Wed, Apr 29, 2015 at 5:34 PM, Simon McVittie
 simon.mcvit...@collabora.co.uk wrote:
 On 29/04/15 15:08, Umut Tezduyar Lindskog wrote:
 We [1] have noticed that there could be up to %50 performance gain on
 using sd-bus over gdbus on dbus-daemon.
 ...
 gdbus.c
   - g_dbus_proxy_new_for_bus_sync()
   - 50 x g_dbus_proxy_call_sync()

 sdbus.c
   - sd_bus_open_system()
   - 50 x sd_bus_get_property()

 If you want to compare apples with apples, I suggest using the
 lower-level g_bus_get() and g_dbus_connection_call[_sync]() instead of
 GDBusProxy. The design and priorities of sd-bus and GDBus are not really
 very similar, but GDBusProxy is certainly not the closest equivalent you
 can get.

 Thanks for the tip. I will re-run the measurements with
 g_dbus_connection_call_sync(g_bus_get_sync(),...). Just considering
 the traffic in the dbus, I do believe we have compared apple to apple.
 But if you believe we might get even more performance with raw API
 calls, then that is fantastic news!

Unfortunately I didn't get any better result with
g_dbus_connection_call_sync. I have updated the link
(https://drive.google.com/open?id=1O3FEnpdZ2auisYalKT6qJTiNV9cfDxya_qisbpGj3MQauthuser=0)
with the source code if you would like to double check my work.

Umut



 Also, if your application profile is such that (a) D-Bus is a
 significant factor in performance, and (b) sending 50 synchronous D-Bus
 messages per connection is anywhere near realistic, then you are
 probably not using D-Bus the way it is designed to be used.

 Measurement we have done was not about if dbus is the ipc we want or
 not. It was about comparing the performances of two libraries. It
 wouldn't have been fair to compare sending only 1 message on the dbus
 due to the performance penalty of creating a worker thread with gdbus.
 But it really didn't matter. 1, 2, 10, 50, in all cases gdbus
 (GDBusProxy) couldn't performed as good as sd-bus.


 See also http://permalink.gmane.org/gmane.comp.freedesktop.dbus/13663.

 --
 Simon McVittie
 Collabora Ltd. http://www.collabora.com/

 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] sd-bus vs gdbus on dbus-daemon

2015-04-30 Thread Umut Tezduyar Lindskog
Hi Greg,

On Wed, Apr 29, 2015 at 5:49 PM, Greg KH gre...@linuxfoundation.org wrote:
 On Wed, Apr 29, 2015 at 04:08:50PM +0200, Umut Tezduyar Lindskog wrote:
 Hi,

 We [1] have noticed that there could be up to %50 performance gain on
 using sd-bus over gdbus on dbus-daemon. For this reason, we have high
 interest in using sd-bus. What are the plans in terms of making sd-bus
 API public?

 Details of the test [2]:

 gdbus.c
   - g_dbus_proxy_new_for_bus_sync()
   - 50 x g_dbus_proxy_call_sync()

 sdbus.c
   - sd_bus_open_system()
   - 50 x sd_bus_get_property()

 Two applications are run with ltrace, perf stat -e cycles, time
 and the results are compared.

 I'll echo Simon's statement here, making a call to
 g_dbus_proxy_call_sync() seems like an odd thing to test.  Is this
 really how your application wants to work?  Is it the normal call path
 that you need optimized?  How many messages do you normally send, or
 want to send, and how big of the data blob are you wanting to
 transmit/receive here?

We have variety of dbus clients sending small/big slow/fast sync/async
messages. But we have not focused on dbus's performance in the
experiment. We wanted to see the efficiency of 2 user space libraries
when it comes to a very simple use case (synchronously retrieving a
property).


 I ask as I'm trying to find how people would like to use D-Bus, if the
 existing dbus-daemon were sped up in various ways.

 Both of these traces show that userspace is sitting around for most of
 the time, I don't see a whole lot of actual CPU usage happening, do you?

Could you please explain how did you come up with that conclusion?
Granted not the top 10 calls are in g... libraries but there are many
entries that program has spent time in g... library. Also the pthread.

Umut


 thanks,

 greg k-h
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] sd-bus vs gdbus on dbus-daemon

2015-04-29 Thread Greg KH
On Wed, Apr 29, 2015 at 04:08:50PM +0200, Umut Tezduyar Lindskog wrote:
 Hi,
 
 We [1] have noticed that there could be up to %50 performance gain on
 using sd-bus over gdbus on dbus-daemon. For this reason, we have high
 interest in using sd-bus. What are the plans in terms of making sd-bus
 API public?
 
 Details of the test [2]:
 
 gdbus.c
   - g_dbus_proxy_new_for_bus_sync()
   - 50 x g_dbus_proxy_call_sync()
 
 sdbus.c
   - sd_bus_open_system()
   - 50 x sd_bus_get_property()
 
 Two applications are run with ltrace, perf stat -e cycles, time
 and the results are compared.

I'll echo Simon's statement here, making a call to
g_dbus_proxy_call_sync() seems like an odd thing to test.  Is this
really how your application wants to work?  Is it the normal call path
that you need optimized?  How many messages do you normally send, or
want to send, and how big of the data blob are you wanting to
transmit/receive here?

I ask as I'm trying to find how people would like to use D-Bus, if the
existing dbus-daemon were sped up in various ways.

Both of these traces show that userspace is sitting around for most of
the time, I don't see a whole lot of actual CPU usage happening, do you?

thanks,

greg k-h
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] sd-bus vs gdbus on dbus-daemon

2015-04-29 Thread Simon McVittie
On 29/04/15 16:49, Greg KH wrote:
 I'll echo Simon's statement here, making a call to
 g_dbus_proxy_call_sync() seems like an odd thing to test.  Is this
 really how your application wants to work?  Is it the normal call path
 that you need optimized?

To be completely clear here: I am not saying that GDBusProxy is an
unusual thing for an application to be using - far from it, it is a
convenient high-level API that can cover a lot of use-cases, and if I
wanted to write code to (say) manipulate systemd's D-Bus interfaces,
it's what I'd use.

What I *am* saying is that GDBusProxy is nowhere near the performance
end of the performance/convenience trade-off, either in general, among
D-Bus implementations specifically, or even within GDBus - which makes
it an odd thing to benchmark. If it shows up as a significant impact in
your profiling, then that might well indicate that you're using the
wrong tool for the job.

An analogy: suppose you told me you were interested in switching from
some Python code that constructs MIME emails to some C code that does
the same, because you need to send patches to systemd-devel faster.
Instead of worrying about how efficiently-implemented those MIME modules
were, I'd be asking you why (and whether) you are sending enough patches
that it makes any practical difference, and if you are, whether pushing
them to a git repository might make more sense :-)

-- 
Simon McVittie
Collabora Ltd. http://www.collabora.com/

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] sd-bus vs gdbus on dbus-daemon

2015-04-29 Thread Umut Tezduyar Lindskog
Hi,

We [1] have noticed that there could be up to %50 performance gain on
using sd-bus over gdbus on dbus-daemon. For this reason, we have high
interest in using sd-bus. What are the plans in terms of making sd-bus
API public?

Details of the test [2]:

gdbus.c
  - g_dbus_proxy_new_for_bus_sync()
  - 50 x g_dbus_proxy_call_sync()

sdbus.c
  - sd_bus_open_system()
  - 50 x sd_bus_get_property()

Two applications are run with ltrace, perf stat -e cycles, time
and the results are compared.

[1] - Most of the work is done by Jonatan Nilsson, I have added minor points.
[2] - Full implementation details -
https://drive.google.com/open?id=1O3FEnpdZ2auisYalKT6qJTiNV9cfDxya_qisbpGj3MQauthuser=0
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] sd-bus vs gdbus on dbus-daemon

2015-04-29 Thread Simon McVittie
On 29/04/15 15:08, Umut Tezduyar Lindskog wrote:
 We [1] have noticed that there could be up to %50 performance gain on
 using sd-bus over gdbus on dbus-daemon.
...
 gdbus.c
   - g_dbus_proxy_new_for_bus_sync()
   - 50 x g_dbus_proxy_call_sync()
 
 sdbus.c
   - sd_bus_open_system()
   - 50 x sd_bus_get_property()

If you want to compare apples with apples, I suggest using the
lower-level g_bus_get() and g_dbus_connection_call[_sync]() instead of
GDBusProxy. The design and priorities of sd-bus and GDBus are not really
very similar, but GDBusProxy is certainly not the closest equivalent you
can get.

Also, if your application profile is such that (a) D-Bus is a
significant factor in performance, and (b) sending 50 synchronous D-Bus
messages per connection is anywhere near realistic, then you are
probably not using D-Bus the way it is designed to be used.

See also http://permalink.gmane.org/gmane.comp.freedesktop.dbus/13663.

-- 
Simon McVittie
Collabora Ltd. http://www.collabora.com/

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel