Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XFIfC-0007gD-5s for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Aug 2014 08:03:06 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XFIfB-0005EG-EC for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Aug 2014 08:03:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XFIfA-0005E5-7V for pgsql-hackers@postgresql.org; Thu, 07 Aug 2014 08:03:04 +0000 Received: from smtp-outbound-1.vmware.com ([208.91.2.12]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XFIez-0006dY-LJ for pgsql-hackers@postgresql.org; Thu, 07 Aug 2014 08:03:01 +0000 Received: from sc9-mailhost3.vmware.com (sc9-mailhost3.vmware.com [10.113.161.73]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id E669D295C3; Thu, 7 Aug 2014 01:02:47 -0700 (PDT) Received: from EX13-CAS-011.vmware.com (EX13-CAS-011.vmware.com [10.113.191.63]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id E164D40617; Thu, 7 Aug 2014 01:02:47 -0700 (PDT) Received: from EX13-MBX-024.vmware.com (10.113.191.44) by EX13-MBX-013.vmware.com (10.113.191.33) with Microsoft SMTP Server (TLS) id 15.0.775.38; Thu, 7 Aug 2014 01:02:35 -0700 Received: from [192.168.1.90] (10.113.160.246) by EX13-MBX-024.vmware.com (10.113.191.44) with Microsoft SMTP Server (TLS) id 15.0.775.38; Thu, 7 Aug 2014 01:02:34 -0700 Message-ID: <53E33297.2020706@vmware.com> Date: Thu, 7 Aug 2014 11:02:31 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0 MIME-Version: 1.0 To: Mitsumasa KONDO , Fujii Masao CC: PostgreSQL-development Subject: Re: posix_fadvise() and pg_receivexlog References: <53E27B13.50506@vmware.com> In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.113.160.246] X-ClientProxiedBy: EX13-CAS-013.vmware.com (10.113.191.65) To EX13-MBX-024.vmware.com (10.113.191.44) X-Pg-Spam-Score: -7.6 (-------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 08/07/2014 10:10 AM, Mitsumasa KONDO wrote: > 2014-08-07 13:47 GMT+09:00 Fujii Masao : > >> On Thu, Aug 7, 2014 at 3:59 AM, Heikki Linnakangas >> wrote: >>> On 08/06/2014 08:39 PM, Fujii Masao wrote: >>>> The WAL files that pg_receivexlog writes will not be re-read soon >>>> basically, >>>> so we can advise the OS to release any cached pages when WAL file is >>>> closed. I feel inclined to change pg_receivexlog that way. Thought? >>> >>> >>> -1. The OS should be smart enough to not thrash the cache by files that >> are >>> written sequentially and never read. >> > OS's buffer strategy is optimized for general situation. Do you forget OS > hackers discussion last a half of year? > >> Yep, the OS should be so smart, but I'm not sure if it actually is. Maybe >> not, >> so I was thinking that posix_fadvise is called when the server closes WAL >> file. > > That's right. Well, I'd like to hear someone from the field complaining that pg_receivexlog is thrashing the cache and thus reducing the performance of some other process. Or a least a synthetic test case that demonstrates that happening. > By the way, does pg_receivexlog process have fsync() in every WAL commit? It fsync's each file after finishing to write it. Ie. each WAL file is fsync'd once. > If yes, I think that we need no or less fsync() option for the better > performance. It is general in NOSQL storages. > If no, we need fsync() option for more getting reliability and data > integrarity. Hmm. An fsync=off style option might make sense, although I doubt the one fsync at end of file is causing a performance problem for anyone in practice. Haven't heard any complaints, anyway. An option to fsync after every commit record might make sense if you use pg_receivexlog with synchronous replication. Doing that would require parsing the WAL, though, to see where the commit records are. But then again, the fsync's wouldn't need to correspond to commit records. We could fsync just before we go to sleep to wait for more WAL to be received. - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers