From owner-freebsd-bugs@FreeBSD.ORG Fri May 4 15:17:44 2007 Return-Path: X-Original-To: freebsd-bugs@freebsd.org Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9619916A402 for ; Fri, 4 May 2007 15:17:44 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 13E4313C448 for ; Fri, 4 May 2007 15:17:43 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from kobe.laptop (host5.bedc.ondsl.gr [62.103.39.229]) (authenticated bits=128) by igloo.linux.gr (8.13.8/8.13.8/Debian-3) with ESMTP id l44F3xKS008568 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 4 May 2007 18:04:05 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.1/8.14.1) with ESMTP id l44F3e15022701; Fri, 4 May 2007 18:03:53 +0300 (EEST) (envelope-from keramida@freebsd.org) Received: (from keramida@localhost) by kobe.laptop (8.14.1/8.14.1/Submit) id l44F3eKK022700; Fri, 4 May 2007 18:03:40 +0300 (EEST) (envelope-from keramida@freebsd.org) Date: Fri, 4 May 2007 18:03:40 +0300 From: Giorgos Keramidas To: Gavin Atkinson Message-ID: <20070504150339.GA22517@kobe.laptop> References: <200705041450.l44EoAJC003185@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200705041450.l44EoAJC003185@freefall.freebsd.org> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.81, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.59, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@freebsd.org X-Spam-Status: No Cc: freebsd-bugs@freebsd.org Subject: Re: bin/89762: [patch] top(1) startup is very slow on system with many users X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 May 2007 15:17:44 -0000 On 2007-05-04 14:50, Gavin Atkinson 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).