X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5763232A1F1 for ; Sat, 9 Oct 2004 12:20:58 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34288-05 for ; Sat, 9 Oct 2004 11:20:50 +0000 (GMT) Received: from sccrmhc13.comcast.net (sccrmhc13.comcast.net [204.127.202.64]) by svr1.postgresql.org (Postfix) with ESMTP id 875FC32A1B6 for ; Sat, 9 Oct 2004 12:20:50 +0100 (BST) Received: from sysexperts.com (c-24-6-183-218.client.comcast.net[24.6.183.218]) by comcast.net (sccrmhc13) with ESMTP id <2004100911204901600c0k3ne>; Sat, 9 Oct 2004 11:20:50 +0000 Received: from localhost (localhost [127.0.0.1]) (uid 1000) by filer with local; Sat, 09 Oct 2004 04:20:48 -0700 id 0000545D.4167C990.00003826 Date: Sat, 9 Oct 2004 04:20:48 -0700 From: Kevin Brown To: pgsql-performance@postgresql.org Subject: Re: First set of OSDL Shared Mem scalability results, some wierdness ... Message-ID: <20041009112048.GA665@filer> Mail-Followup-To: Kevin Brown , pgsql-performance@postgresql.org References: <200410081443.16109.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: Organization: Frobozzco International User-Agent: Mutt/1.5.6+20040818i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/119 X-Sequence-Number: 8595 Christopher Browne wrote: > Increasing the number of cache buffers _is_ likely to lead to some > slowdowns: > > - Data that passes through the cache also passes through kernel > cache, so it's recorded twice, and read twice... Even worse, memory that's used for the PG cache is memory that's not available to the kernel's page cache. Even if the overall memory usage in the system isn't enough to cause some paging to disk, most modern kernels will adjust the page/disk cache size dynamically to fit the memory demands of the system, which in this case means it'll be smaller if running programs need more memory for their own use. This is why I sometimes wonder whether or not it would be a win to use mmap() to access the data and index files -- doing so under a truly modern OS would surely at the very least save a buffer copy (from the page/disk cache to program memory) because the OS could instead direcly map the buffer cache pages directly to the program's memory space. Since PG often has to have multiple files open at the same time, and in a production database many of those files will be rather large, PG would have to limit the size of the mmap()ed region on 32-bit platforms, which means that things like the order of mmap() operations to access various parts of the file can become just as important in the mmap()ed case as it is in the read()/write() case (if not more so!). I would imagine that the use of mmap() on a 64-bit platform would be a much, much larger win because PG would most likely be able to mmap() entire files and let the OS work out how to order disk reads and writes. The biggest problem as I see it is that (I think) mmap() would have to be made to cooperate with malloc() for virtual address space. I suspect issues like this have already been worked out by others, however... -- Kevin Brown kevin@sysexperts.com