Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 7B21FC83CAD for ; Tue, 10 Jul 2012 09:44:35 -0300 (ADT) Received: from moutng.kundenserver.de ([212.227.17.8]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SoZnt-00063n-V0 for pgsql-performance@postgresql.org; Tue, 10 Jul 2012 12:44:35 +0000 Received: from awork2.localnet (p5DDC7065.dip.t-dialin.net [93.220.112.101]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0Lb2eP-1S4lS53R9d-00kf9O; Tue, 10 Jul 2012 14:44:16 +0200 From: Andres Freund Organization: 2ndquadrant.com To: pgsql-performance@postgresql.org Subject: Re: Massive I/O spikes during checkpoint Date: Tue, 10 Jul 2012 14:44:14 +0200 User-Agent: KMail/1.13.7 (Linux/3.4.0-andres; KDE/4.8.4; x86_64; ; ) Cc: Maxim Boguk , David Kerr References: <27C32FD4-0142-44FE-8488-9F366DC75966@mr-paradox.net> <07928283-528B-4499-BEC2-7E9098D6D734@mr-paradox.net> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201207101444.14887.andres@2ndquadrant.com> X-Provags-ID: V02:K0:BTE94H37H0scQ9V8MyiF+Zmx33kZzCEPjz4b5tAdFa0 DEHSG8sr3/qOoJC/MOaYOcBNxhRCdZvKrIwqSyUFjAu9OzdiXr 0ruyL3+3lAujtoIShE0xVNlvIJpuE2hPFi0oWrgcw0Y9OvO6qO 2PNB77WLa5q2Lp8/oe19X2GyWgnVXORwbdkfROWpleW9SjS/tk HFSJY2bm03TSE1iFBhD7muriw3QERRU99I3sqQC/Js+lrgMcq1 0KlDcsKbCgPYn/s/8ldEQX1OFrDVuUIEiJdQLFeFAtiSNLEzZ1 u4gXAMXTS4fsqqJmjOsL5oLwU6At4scdv6aecQOSUMt/rTwnPl nRcZjFQklFdZCff8WYN+0sVoE3UbCuilIGEBUJMPYwJkSIbqA8 hYkn0Ftlb9Qqw== X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201207/119 X-Sequence-Number: 47300 On Tuesday, July 10, 2012 08:14:00 AM Maxim Boguk wrote: > On Tue, Jul 10, 2012 at 4:03 PM, David Kerr wrote: > > On Jul 9, 2012, at 10:51 PM, Maxim Boguk wrote: > >> But what appears to be happening is that all of the data is being > >> written out at the end of the checkpoint. > >> > >> This happens at every checkpoint while the system is under load. > >> > >> I get the feeling that this isn't the correct behavior and i've done > >> something wrong. > > > > It's not an actual checkpoints. > > It's is a fsync after checkpoint which create write spikes hurting > > server. > > > > You should set sysctl vm.dirty_background_bytes and vm.dirty_bytes to > > reasonable low values > > > > > > So use bla_bytes instead of bla_ratio? > > Yes because on 256GB server > echo 10 > /proc/sys/vm/dirty_ratio > is equivalent to 26Gb dirty_bytes > > and > echo 5 >/proc/sys/vm/dirty_background_ratio > is equivalent to 13Gb dirty_background_bytes > > It is really huge values. > > So kernel doesn't start write any pages out in background before it has at > least 13Gb dirty pages in kernel memory. > And at end of the checkpoint kernel trying flush all dirty pages to disk. Thast not entirely true. The kernel will also writeout pages which haven't been written to for dirty_expire_centisecs. But yes, adjusting dirty_* is definitely a good idea. Andres -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services