Re: Memory Issue - Mailing list pgsql-general

From Ioana Danes
Subject Re: Memory Issue
Date
Msg-id 1320331850.70764.YahooMailNeo@web120118.mail.ne1.yahoo.com
Whole thread Raw
In response to Re: Memory Issue  (Scott Marlowe <scott.marlowe@gmail.com>)
List pgsql-general

----- Original Message -----
From: Scott Marlowe <scott.marlowe@gmail.com>
To: Ioana Danes <ioanasoftware@yahoo.ca>
Cc: PostgreSQL General <pgsql-general@postgresql.org>
Sent: Thursday, November 3, 2011 10:30:27 AM
Subject: Re: [GENERAL] Memory Issue

On Thu, Nov 3, 2011 at 7:34 AM, Ioana Danes <ioanasoftware@yahoo.ca> wrote:

> After another half an hour almost the entire swap is used and the system performs really bad 100 TPS or lower.
> It never runs out of memory though!
>
> I would like to ask for your opinion on this issue.
> My concerns are why the memory is not reused earlier and it is using the swapping when the system does only these 2
inserts.
> Is this an OS issue, postgres issue, configuration issue?
> Your advice is greatly appreciated.

You can try a few things.

1: lower your shared_buffers.  It's unlikely you really need 4G for
them.  A few hundred megs is probably plenty for the type of work
you're doing.  Let the kernel cache the data you're not hitting right
this second.

2: Set swappiness to 0.    I.e. edit /etc/sysctl.conf and add a line
like vm.swappiness = 0 then run sudo sysctl -p

3: Turn off overcommit.  Same as number 2, set vm.overcommit_memory =
2 which will turn off the ability of linux to overcommit memory and
should then turn off the OOM killer.

4: just turn off swap. With only 16Gigs this is a tad dangerous,
especially if you haven't turned off the OOM in step 3.  Memory is
cheap, throw 32G at least into the machine.  With 1200 users, you
really need plenty of memory.  To turn off swap add something like
/sbin/swapoff -a to the /etc/rc.local file (before the exit line
natch)


Thank you for your quick replay Scott, I will try right now and let you know...
Ioana


pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Memory Issue
Next
From: Tom Lane
Date:
Subject: Re: Strange problem with create table as select * from table;