Re: Massive I/O spikes during checkpoint

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Cc: Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com>, David Kerr <dmk(at)mr-paradox(dot)net>
Subject: Re: Massive I/O spikes during checkpoint
Date: 2012-07-10 12:44:14
Message-ID: 201207101444.14887.andres@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tuesday, July 10, 2012 08:14:00 AM Maxim Boguk wrote:
> On Tue, Jul 10, 2012 at 4:03 PM, David Kerr <dmk(at)mr-paradox(dot)net> 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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jeff Janes 2012-07-10 13:36:35 Re: Massive I/O spikes during checkpoint
Previous Message Pena Kupen 2012-07-10 10:20:06 Fw: Re: Custom function in where clause