Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 May 2007 18:03:40 +0300
From:      Giorgos Keramidas <keramida@freebsd.org>
To:        Gavin Atkinson <gavin.atkinson@ury.york.ac.uk>
Cc:        freebsd-bugs@freebsd.org
Subject:   Re: bin/89762: [patch] top(1) startup is very slow on system with many users
Message-ID:  <20070504150339.GA22517@kobe.laptop>
In-Reply-To: <200705041450.l44EoAJC003185@freefall.freebsd.org>
References:  <200705041450.l44EoAJC003185@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2007-05-04 14:50, Gavin Atkinson <gavin.atkinson@ury.york.ac.uk> wrote:
> This is still a problem with 6.2-STABLE.  On a 2.2GHz amd64 machine
> with ~20,000 NIS users, "top -b" takes 74 seconds before displaying
> any output and generates significant load on the NIS servers.
> 
> wiggum# time top -b
> last pid: 1742; load averages: 0.00, 0.00, 0.00 up 36+03:20:25  15:39:47
> 32 processes:  1 running, 31 sleeping
> 
> Mem: 82M Active, 191M Inact, 108M Wired, 213M Buf, 1498M Free
> Swap: 3072M Total, 3072M Free
> [process list snipped]

Can you truss/ptrace top at the time?  I think it's trying to find the
longest username string, to align the USERNAME column, and it queries
the NIS server for *all* users.

If that is the case, you should see a significant speedup when top runs
with the -u option (but lose the functionality of seeing the username).

We could probably 'trim' long usernames in the USERNAME column and add
a character like '>' shown below:

------------------------------------------------------------------------
  PID USERNAME    THR PRI NICE   SIZE    RES STATE  C   TIME    CPU COMMAND
 4783 giorgosker>   1  96    0   294M 38244K CPU0   0  57:07  1.22% Xorg
22634 giorgosker>   1  96    0 11452K  9868K select 1   0:05  0.93% emacs
19084 giorgosker>   1  96    0  7256K  4176K select 0   2:49  0.88% xterm
  960 root          1  96    0  3160K   864K select 0  12:51  0.00% powerd
------------------------------------------------------------------------

and keep a fixed length for the USERNAME column, but I am not sure if
this would be an acceptablle UI change for top(1).




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070504150339.GA22517>