Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 760821337B82 for ; Thu, 7 Oct 2010 09:47:11 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 74794-10 for ; Thu, 7 Oct 2010 12:47:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mail.postgresql.org (Postfix) with ESMTP id B41651337B50 for ; Thu, 7 Oct 2010 09:47:03 -0300 (ADT) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1P3psE-0002iD-4A for pgsql-performance@postgresql.org; Thu, 07 Oct 2010 14:47:02 +0200 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 07 Oct 2010 14:47:02 +0200 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 07 Oct 2010 14:47:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-performance@postgresql.org From: Ivan Voras Subject: Re: [HACKERS] MIT benchmarks pgsql multicore (up to 48)performance Date: Thu, 07 Oct 2010 14:47:06 +0200 Lines: 43 Message-ID: References: <20101004175545.GA2690@csail.mit.edu> <4CAA21C7.1030701@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.9) Gecko/20100518 Thunderbird/3.0.4 In-Reply-To: X-Enigmail-Version: 1.0.1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/55 X-Sequence-Number: 40474 On 10/07/10 02:39, Robert Haas wrote: > On Wed, Oct 6, 2010 at 6:31 PM, Ivan Voras wrote: >> On 10/04/10 20:49, Josh Berkus wrote: >> >>>> The other major bottleneck they ran into was a kernel one: reading from >>>> the heap file requires a couple lseek operations, and Linux acquires a >>>> mutex on the inode to do that. The proper place to fix this is >>>> certainly in the kernel but it may be possible to work around in >>>> Postgres. >>> >>> Or we could complain to Kernel.org. They've been fairly responsive in >>> the past. Too bad this didn't get posted earlier; I just got back from >>> LinuxCon. >>> >>> So you know someone who can speak technically to this issue? I can put >>> them in touch with the Linux geeks in charge of that part of the kernel >>> code. >> >> Hmmm... lseek? As in "lseek() then read() or write()" idiom? It AFAIK >> cannot be fixed since you're modifying the global "strean position" >> variable and something has got to lock that. > > Well, there are lock free algorithms using CAS, no? Nothing is really "lock free" - in this case the algorithms simply push the locking down to atomic operations on the CPU (and the memory bus). Semantically, *something* has to lock the memory region for however brief period of time and then propagate that update to other CPUs' caches (i.e. invalidate them). >> OTOH, pread() / pwrite() don't have to do that. > > Hey, I didn't know about those. That sounds like it might be worth > investigating, though I confess I lack a 48-core machine on which to > measure the alleged benefit. As Jon said, it will in any case reduce the number of these syscalls by half, and they can be wrapped by a C macro for the platforms which don't implement them. http://man.freebsd.org/pread (and just in case it's needed: pread() is a special case of preadv()).