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 698D232C0D9 for ; Fri, 15 Oct 2004 13:53:25 +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 05648-03 for ; Fri, 15 Oct 2004 12:53:17 +0000 (GMT) Received: from ram.rentec.com (ram.rentec.com [192.5.35.66]) by svr1.postgresql.org (Postfix) with ESMTP id D0A6232C0CE for ; Fri, 15 Oct 2004 13:53:19 +0100 (BST) Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by ram.rentec.com (8.12.9/8.12.1) with ESMTP id i9FCrJnK001841; Fri, 15 Oct 2004 08:53:19 -0400 (EDT) Message-ID: <416FC83F.3020900@rentec.com> Date: Fri, 15 Oct 2004 08:53:19 -0400 From: Alan Stange Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Kevin Brown , pgsql-performance@postgresql.org Subject: Re: First set of OSDL Shared Mem scalability results, some References: <200410081443.16109.josh@agliodbs.com> <20041009112048.GA665@filer> <27696.1097334448@sss.pgh.pa.us> <20041009203710.GB665@filer> <4859.1097363137@sss.pgh.pa.us> <20041014202531.GD665@filer> <5235.1097817216@sss.pgh.pa.us> In-Reply-To: <5235.1097817216@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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/214 X-Sequence-Number: 8690 Tom Lane wrote: >Kevin Brown writes: > > >>Hmm...something just occurred to me about this. >> >> >>Would a hybrid approach be possible? That is, use mmap() to handle >>reads, and use write() to handle writes? >> >> > >Nope. Have you read the specs regarding mmap-vs-stdio synchronization? >Basically it says that there are no guarantees whatsoever if you try >this. The SUS text is a bit weaselly ("the application must ensure >correct synchronization") but the HPUX mmap man page, among others, >lays it on the line: > > It is also unspecified whether write references to a memory region > mapped with MAP_SHARED are visible to processes reading the file and > whether writes to a file are visible to processes that have mapped the > modified portion of that file, except for the effect of msync(). > >It might work on particular OSes but I think depending on such behavior >would be folly... > We have some anecdotal experience along these lines: There was a set of kernel bugs in Solaris 2.6 or 7 related to this as well. We had several kernel panics and it took a bit to chase down, but the basic feedback was "oops. we're screwed". I've forgotten most of the details right now; the basic problem was a file was being read+written via mmap and read()/write() at (essentially) the same time from the same pid. It would panic the system quite reliably. I believe the bugs related to this have been resolved in Solaris, but it was unpleasant to chase that problem down... -- Alan