Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 3A91B632E41 for ; Sat, 4 Apr 2009 13:08:02 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 47699-09 for ; Sat, 4 Apr 2009 13:07:59 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from westnet.com (westnet.com [216.187.52.2]) by mail.postgresql.org (Postfix) with ESMTP id E56A6632204 for ; Sat, 4 Apr 2009 13:07:59 -0300 (ADT) Received: from westnet.com (localhost [127.0.0.1]) by westnet.com (8.14.0/8.14.0) with ESMTP id n34G7wt6000109; Sat, 4 Apr 2009 12:07:58 -0400 (EDT) Received: from localhost (gsmith@localhost) by westnet.com (8.14.0/8.13.2/Submit) with ESMTP id n34G7w6X000106; Sat, 4 Apr 2009 12:07:58 -0400 (EDT) X-Authentication-Warning: westnet.com: gsmith owned process doing -bs Date: Sat, 4 Apr 2009 12:07:58 -0400 (EDT) From: Greg Smith X-X-Sender: gsmith@westnet.com To: Kevin Grittner cc: pgsql-performance@postgresql.org Subject: Re: Strange behavior: pgbench and new Linux kernels In-Reply-To: <49D2466F.EE98.0025.0@wicourts.gov> Message-ID: References: <49D2466F.EE98.0025.0@wicourts.gov> User-Agent: Alpine 2.01 (GSO 1184 2008-12-16) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL=0.000 X-Spam-Level: X-Archive-Number: 200904/99 X-Sequence-Number: 33466 On Tue, 31 Mar 2009, Kevin Grittner wrote: >>>> On Thu, Apr 17, 2008 at 7:26 PM, Greg Smith wrote: > >> On this benchmark 2.6.25 is the worst kernel yet: > > I don't remember seeing a follow-up on this issue from last year. > Are there still any particular kernels to avoid based on this? I just discovered something really fascinating here. The problem is strictly limited to when you're connecting via Unix-domain sockets; use TCP/IP instead, and it goes away. To refresh everyone's memory here, I reported a problem to the LKML here: http://lkml.org/lkml/2008/5/21/292 Got some patches and some kernel tweaks for the scheduler but never a clear resolution for the cause, which kept anybody from getting too excited about merging anything. Test results comparing various tweaks on the hardware I'm still using now are at http://lkml.org/lkml/2008/5/26/288 For example, here's kernel 2.6.25 running pgbench with 50 clients with a Q6000 processor, demonstrating poor performance--I'd get >20K TPS here with a pre-CFS kernel: $ pgbench -S -t 4000 -c 50 -n pgbench transaction type: SELECT only scaling factor: 10 query mode: simple number of clients: 50 number of transactions per client: 4000 number of transactions actually processed: 200000/200000 tps = 8288.047442 (including connections establishing) tps = 8319.702195 (excluding connections establishing) If I now execute exactly the same test, but using localhost, performance returns to normal: $ pgbench -S -t 4000 -c 50 -n -h localhost pgbench transaction type: SELECT only scaling factor: 10 query mode: simple number of clients: 50 number of transactions per client: 4000 number of transactions actually processed: 200000/200000 tps = 17575.277771 (including connections establishing) tps = 17724.651090 (excluding connections establishing) That's 100% repeatable, I ran each test several times each way. So the new summary here of what I've found is that if: 1) You're running Linux 2.6.23 or greater (confirmed in up to 2.6.26) 2) You connect over a Unix-domain socket 3) Your client count is relatively high (>8 clients/core) You can expect your pgbench results to tank. Switch to connecting over TCP/IP to localhost, and everything is fine; it's not quite as fast as the pre-CFS kernels in some cases, in others it's faster though. I haven't gotten to testing kernels newer than 2.6.26 yet, when I saw a 17K TPS result during one of my tests on 2.6.25 I screeched to a halt to isolate this instead. -- * Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD