From owner-freebsd-fs@freebsd.org Wed Dec 30 10:41:01 2015 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE291A55CFE for ; Wed, 30 Dec 2015 10:41:00 +0000 (UTC) (envelope-from ndevos@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C78521C10 for ; Wed, 30 Dec 2015 10:41:00 +0000 (UTC) (envelope-from ndevos@redhat.com) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 222E6263D; Wed, 30 Dec 2015 10:31:55 +0000 (UTC) Received: from localhost (vpn1-6-200.ams2.redhat.com [10.36.6.200]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBUAVrYV001077 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 30 Dec 2015 05:31:54 -0500 Date: Wed, 30 Dec 2015 11:31:52 +0100 From: Niels de Vos To: Rick Macklem Cc: gluster-devel@gluster.org, freebsd-fs Subject: Re: [Gluster-devel] FreeBSD port of GlusterFS racks up a lot of CPU usage Message-ID: <20151230103152.GS13942@ndevos-x240.usersys.redhat.com> References: <571237035.145690509.1451437960464.JavaMail.zimbra@uoguelph.ca> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gqEssfNGWsEa4HfM" Content-Disposition: inline In-Reply-To: <571237035.145690509.1451437960464.JavaMail.zimbra@uoguelph.ca> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 10:41:01 -0000 --gqEssfNGWsEa4HfM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 29, 2015 at 08:12:40PM -0500, Rick Macklem wrote: > Hi, >=20 > I'm been playing with the FreeBSD port of GlusterFS and it seems > to be working ok. I do notice that the daemons use a lot of CPU, > even when there is nothing to do (no volumes started, etc). > When I ktrace the daemon, I see a small number of nanosleep() and > select() syscalls and lots of poll() syscalls (close to 1000/sec). >=20 > Looking at libglusterfs/src/event-poll.c, I find: > ret =3D poll(ufds, size, 1); > in a loop. The only thing the code seems to do when poll() times > out is a call to event_dispatch_poll_resize(). >=20 > So, is it necessary to call event_dispatch_poll_resize() 1000 times > per second? > Or is there a way to make event_dispatch_poll_resize() return quickly > when there is nothing to do? I do not think this is critical. A longer timeout should be well acceptable. > I'm guessing that Linux uses the event-epoll stuff instead of event-poll, > so it wouldn't exhibit this. Is that correct? Well, both. most (if not all) Linux builds will use event-poll. But, that calls epoll_wait() with a timeout of 1 millisecond as well. > Thanks for any information on this, rick > ps: I am tempted to just crank the timeout of 1msec up to 10 or 20msec. Yes, that is probably what I would do too. And have both poll functions use the same timeout, have it defined in libglusterfs/src/event.h. We could make it a configurable option too, but I do not think it is very useful to have. Could you file a bug and/or send a patch for this? Thanks, Niels --gqEssfNGWsEa4HfM Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWg7KYAAoJECXo5AApwsWz1C8P/R4HbFzWERHQYuMm0Rhvh7O9 Fcs+CKP2emf9uwAeGtrtwwfCfskcd2J15jJkN50loCBNOYaBgz2Wjf/OzhLU2NAB xyrQl0jEbe7e8UEvbip0NWMh5l6j8mC9ylob9DSpBwhh6o3hk3Sbf7DqXexjKsmW evGozvFStuO2HtQBxGnQThVNRgMJFYYafjTNOMkGKahPwLNPgO9A1wWFDEE31/gJ v7PFnnQ2Zi2GA17TPV2SoG7o0dsB7BmWlGDxoD0dPLMdhCO1jcimtF9GfZQ6H81e D6NBvIGkDUMqjnbYIpTB9msqcGYBqtMlEEtVbwiw24WIEtgmbJI/5SeZiU7TGpOr 4dTBTMwUrvzNvUY32LaB5pDsaHYUZIQpY233qsHd/QumjhEsD9mZBhNExApOLgPZ qHRNY8Zlsr/o4I7bPGr2weiZ0BcEj9u3GPSe76Sk0C3AcErwXUi19844L5zM6a9z H5DsCDam68LpVLg5LUK2nK/U8k1hs2xejpvnkRLsmmYeVcp9w+gBygQx2Iwoww4w HLOCADYdBALjC2phOKZEfeRJFnvvFANnP6tYFp+ss3WhZQB4pfH5aaO8FPwYbX2a a+u7YXQ3EYFxRXUOCTVxQKrcV7Tshjdt5dCy9F/YNkG5tfCJAFXx+QgLH8v+VXNP 3Fq4eYm8K66KPAtg/xcw =MKgt -----END PGP SIGNATURE----- --gqEssfNGWsEa4HfM--