pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: pinker <pinker@onet.eu>
To: pgsql-general@postgresql.org
Subject: Re: dirty_ratio & dirty_background_ratio settings with huge memory
Date: Wed, 07 Mar 2018 08:22:22 +0100
Message-ID: <1520407342.2421.8.camel@cybertec.at> (raw)
In-Reply-To: <1520388352198-0.post@n3.nabble.com>
References: <1520331809441-0.post@n3.nabble.com>
	<1520338619.2601.26.camel@cybertec.at>
	<1520388352198-0.post@n3.nabble.com>

pinker wrote:
> Laurenz Albe wrote
> > Yes, you should set vm.dirty_background_bytes and vm.dirty_bytes
> > and not use the *_ratio settings.
> > 
> > 2 GB for vm.dirty_background_bytes and 1 GB for vm.dirty_bytes sounds
> > fine.

To repeat (for the archive): it should be the other way round.

> Thank you Laurenz. I was always wondering why not to set bigger window
> between those 2. Because setting dirty_background_bytes seems quite natural
> for me, i.e. start to write asynchronously faster, but why to provoke stalls
> faster? is it not better to stretch the window much wider, like 1GB for
> dirty_background_bytes and for instance 20 GB dirty_bytes? it's the Approach
> 3: Both Ways from
> https://lonesysadmin.net/2013/12/22/better-linux-disk-caching-performance-vm-dirty_ratio/

I'd say that setting vm.dirty_background_bytes low and vm.dirty_bytes
very high is not a good idea, at least for databases:

- If flushing data to disk in the background can keep up with the write
  activity, you're fine.  But then you'd also be fine with a lower setting
  for vm.dirty_bytes, right?

- If flushing to disk cannot keep up with the write activity, you'll get
  an I/O spike when everything is flushed to disk at checkpoint time and
  the database may become unresponsive for a while.

The idea behind a low vm.dirty_bytes setting is to avoid one big I/O spike
and have several smaller ones instead.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




view thread (9+ messages)

Message-ID: <1520407342.2421.8.camel@cybertec.at>
Permalink:  ../1520407342.2421.8.camel@cybertec.at/
Also on:    postgresql.org/message-id/1520407342.2421.8.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, pinker@onet.eu
  Subject: Re: dirty_ratio & dirty_background_ratio settings with huge memory
  In-Reply-To: <1520407342.2421.8.camel@cybertec.at>
  References: <1520331809441-0.post@n3.nabble.com> <1520338619.2601.26.camel@cybertec.at> <1520388352198-0.post@n3.nabble.com> <1520407342.2421.8.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox