Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id A3E0C633461; Mon, 28 Dec 2009 20:46:55 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 35501-02; Tue, 29 Dec 2009 00:46:44 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by mail.postgresql.org (Postfix) with ESMTP id DABF7632C8F; Mon, 28 Dec 2009 20:46:44 -0400 (AST) Received: from [192.168.1.3] (pool-96-244-14-10.bltmmd.fios.verizon.net [96.244.14.10]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0MHKSt-1NCW3P1CT5-00Dw5F; Tue, 29 Dec 2009 01:46:42 +0100 Message-ID: <4B39515D.6050309@2ndquadrant.com> Date: Mon, 28 Dec 2009 19:46:21 -0500 From: Greg Smith User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Andres Freund CC: pgsql-hackers@postgresql.org, Tom Lane , pgsql-performance@postgresql.org, Michael Clemmons , Hannu Krosing , Scott Marlowe Subject: Re: [HACKERS] Faster CREATE DATABASE by delaying fsync (was 8.4.1 ubuntu karmic slow createdb) References: <4427a97a0912101235x3ade510blcc00d5ce9883c6b6@mail.gmail.com> <200912282354.51892.andres@anarazel.de> <3454.1262041588@sss.pgh.pa.us> <200912290020.35843.andres@anarazel.de> In-Reply-To: <200912290020.35843.andres@anarazel.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX19lgC6USYcRrlWPj4LbcHX1QFAD9XTrHKv+zbO J+robAKY5KTKEhyKvHuRdbcUwk9R6quVP0u7R1nDPawjSeB+kX IW6h7wi1nCfg3xEpQpFhH06CAh0Yc4p X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200912/256 X-Sequence-Number: 36870 Andres Freund wrote: > As I said the real benefit only occurred after adding posix_fadvise(.., > FADV_DONTNEED) which is somewhat plausible, because i.e. the directory entries > don't need to get scheduled for every file and because the kernel can reorder a > whole directory nearly sequentially. Without the advice it the kernel doesn't > know in time that it should write that data back and it wont do it for 5 > seconds by default on linux or such... > I know they just fiddled with the logic in the last release, but for most of the Linux kernels out there now pdflush wakes up every 5 seconds by default. But typically it only worries about writing things that have been in the queue for 30 seconds or more until you've filled quite a bit of memory, so that's also an interesting number. I tried to document the main tunables here and describe how they fit together at http://www.westnet.com/~gsmith/content/linux-pdflush.htm It would be interesting to graph the "Dirty" and "Writeback" figures in /proc/meminfo over time with and without this patch in place. That should make it obvious what the kernel is doing differently in the two cases. -- Greg Smith 2ndQuadrant Baltimore, MD PostgreSQL Training, Services and Support greg@2ndQuadrant.com www.2ndQuadrant.com