Bug 4232 - xlsclients much too slow over network
Summary: xlsclients much too slow over network
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: App/other (show other bugs)
Version: git
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-25 00:42 UTC by Ian! D. Allen
Modified: 2009-10-19 18:51 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
XCB conversion of xlsclients.c (15.71 KB, text/plain)
2009-09-01 17:40 UTC, Peter Harris
no flags Details

Description Ian! D. Allen 2005-08-25 00:42:15 UTC
My net connection is ADSL, 2.2Mbit down, 1.1Mbit up.

I have various X clients open on my desktop, created via ssh logins to
various other machines.

I ssh to a remote system and then:

    % time xlsclients
    host1.ca  xosview
    host1.ca  xbiff -geometry 200x200+460+600
    host1.ca  mozilla-bin
    host2.ca  xload -geometry 115x115+300+360
    host3.ca  xload -geometry 115x115+300+120
    host4.ca  xload -geometry 115x115+420+480
    host5.ca  xload -geometry 120x120+0+0
    host1.ca  /usr/bin/Eterm
    host1.ca  Eterm
    host1.ca  Eterm
    host1.ca  xload -geometry 115x115+420+0
    host1.ca  Eterm
    0.010u 0.230s 0:57.85 0.4%      0+68k 0+0io 0pf+0w

It takes 57 seconds to produce 12 lines of output.

I ssh to a different system:

    % time xlsclients
    host1.ca  xosview
    host1.ca  xbiff -geometry 200x200+460+600
    host1.ca  mozilla-bin
    host1.ca  xload -geometry 115x115+420+0
    host2.ca  xload -geometry 115x115+300+360
    host3.ca  xload -geometry 115x115+300+120
    host4.ca  xload -geometry 115x115+420+480
    host5.ca  xload -geometry 120x120+0+0
    host1.ca  /usr/bin/Eterm   
    host1.ca  Eterm        
    host1.ca  Eterm         
    host1.ca  Eterm        
    0.023u 0.048s 0:56.85 0.1%      0+0k 0+0io 0pf+0w

Another 56 seconds to produce 12 lines.

Watching my local Ethernet switch status lights, my ADSL status lights,
and confirming with tcpdump, I see a *lot* of ssh traffic being exchanged.

Every new client adds about another 5 seconds to the wait.

Running xlsclients locally on my desktop is virtually instantaneous.

How can I speed up remote xlsclients?   What is it doing, that it has
to transfer so much data to produce 12 lines of output?

xorg-x11-6.9-0.cvs20050810.6mdk
Comment 1 Daniel Stone 2007-02-27 01:27:43 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 2 Alan Coopersmith 2009-09-01 07:37:02 UTC
xlsclients makes many calls that block waiting for a response from the
server.   Performance could probably be improved by porting from libX11
to libxcb to allow these calls to operate asynchronously.
Comment 3 Ian! D. Allen 2009-09-01 08:07:48 UTC
This is still a problem:
    Ubuntu 8.10
    xorg 1:7.4~5ubuntu3

$ time xlsclients | wc
     17     124    1566

real    1m13.236s
user    0m0.012s
sys     0m0.072s

It takes 73 seconds to produce 17 lines of output on the remote system!

On the local system:

$ time xlsclients | wc
     18     126    1600

real	0m0.224s
user	0m0.016s
sys	0m0.028s

Comment 4 Peter Harris 2009-09-01 17:40:34 UTC
Created attachment 29086 [details]
XCB conversion of xlsclients.c
Comment 5 Peter Harris 2009-09-01 17:42:23 UTC
Could you please try the attached XCB conversion of xlsclients.c? I'm curious to know how much it helps your case.
Comment 6 Ian! D. Allen 2009-09-02 11:53:29 UTC
Peter Harris wrote:
> Could you please try the attached XCB conversion of xlsclients.c?

Yes, that new XCB version fixes the huge delay:

time ./xlsclients  | wc
      17     126    1566

  real    0m1.823s
  user    0m0.000s
  sys     0m0.008s

Only 49 "select" syscalls instead of over a thousand, and less than two
seconds of elapsed time instead of 60+ seconds.  That works.

When can this version of xlsclients be made mainstream?
Comment 7 Peter Harris 2009-10-19 10:38:47 UTC
More polished version of the patch:

git://anongit.freedesktop.org/~peterh/xlsclients master
Comment 8 Jamey Sharp 2009-10-19 18:51:07 UTC
Thanks Peter! After review, I've merged your work to xlsclients master, though I'm leaving it to somebody else to roll a new 2.0 release.

I merged your three commits into one, as they aren't independently usable; rebased on master, which surprisingly has changed in the last month; and I fixed some spurious whitespace and type diffs. Otherwise I left your code alone.

Again, thanks for doing this work! Want to port some more apps now? :-) Alan suggested xprop as a good candidate...


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.