X-Original-To: pgsql-committers@postgresql.org Received: from perrin.int.nxad.com (internal.ext.nxad.com [69.1.70.251]) by postgresql.org (Postfix) with ESMTP id E8ED0476128 for ; Thu, 6 Mar 2003 04:41:29 -0500 (EST) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id C122321059; Thu, 6 Mar 2003 01:41:17 -0800 (PST) Date: Thu, 6 Mar 2003 01:41:17 -0800 From: Sean Chittenden To: Tom Lane Cc: Christopher Kings-Lynne , pgsql-committers@postgresql.org Subject: Re: pgsql-server/ /configure /configure.in rc/incl ... Message-ID: <20030306094117.GA79234@perrin.int.nxad.com> References: <20030306031656.1876F4762E0@postgresql.org> <032f01c2e390$b1842b20$6500a8c0@fhp.internal> <11077.1046921667@sss.pgh.pa.us> <033f01c2e392$71476570$6500a8c0@fhp.internal> <12228.1046922471@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="G5yIW5EaChZ5gJdA" Content-Disposition: inline In-Reply-To: <12228.1046922471@sss.pgh.pa.us> User-Agent: Mutt/1.4i X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 X-Web-Homepage: http://sean.chittenden.org/ X-Archive-Number: 200303/55 X-Sequence-Number: 9298 --G5yIW5EaChZ5gJdA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > >>> Has anyone ever thought about adding kqueue (for *BSD) support to > >>> Postgres, instead of using select? > >>=20 > >> Why? poll() is standard. kqueue isn't, AFAIK. >=20 > > It's supposed be a whole heap faster - there is no polling involved... >=20 > Supposed by whom? Faster than what? And how would it not poll? >=20 > The way libpq uses this call, it's either probing for current status > (timeout=3D0) or it's willing to block, possibly indefinitely, until the > desired condition arises. It does not sit there in a busy-wait loop. > I can't see any reason to think that an OS-specific API would give > any marked difference in performance. Heh, kqueue is _the_ reason to use FreeBSD. http://www.kegel.com/dkftpbench/Poller_bench.html#results I've toyed with the idea of adding this because it is monstrously more efficient than select()/poll() in basically every way, shape, and form. That said, in terms of performance perks, I'd think migrating the backend to using mmap() would yield a bigger performance benefit (see Stevens) to a larger group of people than adding FreeBSD's kqueue interface (something I plan on doing at some point if no one beats me to it). mmap() + write() for FreeBSD is a zero-copy socket operation and likely is on other platforms. Reducing the number of pages that have to be copied around would be a big win in terms of sending data to clients as well as scanning through data. Files are also only mmap()'ed in the kernel once with BSD's VM system which could reduce the RAM consumed by backends considerably. mmap() would also be an interesting way of providing some kind of atomicity for MVCC (re: WAL, use msync() to have the mapped region hit the disk before the change). I was actually quite surprised when I grep'ed through the code and found that mmap() wasn't in use _anywhere_. The TODO seems to be full of messages, but not much in the way of authoritative statements. Is this one of the areas of PostgreSQL that just needs to get slowly migrated to use mmap() or are there any gaping reasons why to not use the family of system calls? -sc --=20 Sean Chittenden --G5yIW5EaChZ5gJdA Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Comment: Sean Chittenden iD8DBQE+Zxe93ZnjH7yEs0ERAmcgAJ9zLfxB62TbCeeXby7GEsZBpOb0rACg5OR4 AanBKeFWVvARKCN0Un/xCm8= =6nPT -----END PGP SIGNATURE----- --G5yIW5EaChZ5gJdA--