Re: Postgre Eating Up Too Much RAM

From: Aaron Bono <aaron(dot)bono(at)aranya(dot)com>
To: Jesper Krogh <jesper(at)krogh(dot)cc>, Postgres <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Postgre Eating Up Too Much RAM
Date: 2013-01-03 02:10:30
Message-ID: CAAbw2tWxLNxPvbe_QxQ4W5Dm2D-oCTi9M6hdZ-4Wm3t8Y3=0MA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Wed, Jan 2, 2013 at 1:38 AM, Jesper Krogh <jesper(at)krogh(dot)cc> wrote:

> I do suspect you have too much IO going on for the hardware.
>
> I would trim down. /proc/sys/vm/dirty_ratio and dirty_background_ratio to
> 2 and 1 and see if the problem goes away.
>
> And establish graphing of the io-wait numbers if you dont have that
> allready.
>

I didn't know about this setting, thanks for the information.

I have been doing some reading on these settings and hope I am coming to an
understanding. Can you help clarify whether I am understanding this
properly?

So this setting is the amount of disk writes, as a percentage of the RAM
both physical and virtual available, that will be held before writing to
the disk? Which then would mean that the more RAM you have the more will
build up before a write? So at some point there would be some trigger to
fire off the write and since we have so much RAM it could take quite some
time to finish the write causing the server to appear to become
unresponsive?

If my understanding of this is correct and it will block all processes
while until it falls under the dirty_background_ratio then the bigger the
difference between the dirty_ratio and dirty_background_ratio and the more
RAM and swap you have the longer it will block all processes (causing the
server to appear to lock up?). That would definitely lead the the problems
I am experiencing.

The odd thing is that the articles I am reading suggest increasing the
dirty_ratio and decreasing the dirty_background_ratio which is the opposite
of what you are suggesting.

http://rackerhacker.com/2008/08/07/reduce-disk-io-for-small-reads-using-memory/

Though I think these suggest lowering the ratios:

http://www.gossamer-threads.com/lists/linux/kernel/1017204
and
http://arighi.blogspot.com/2008/10/fine-grained-dirtyratio-and.html

I just want to make sure I understand this setting before making the change.

Thank you very much for your help!

-Aaron

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Baptiste LHOSTE 2013-01-03 10:26:37 Re: Autovacuum issues with truncate and create index ...
Previous Message ynux 2013-01-02 14:50:14 SQL to monitor postgres with prtg /