Re: shared_buffers formula - Mailing list pgsql-general

From Scott Marlowe
Subject Re: shared_buffers formula
Date
Msg-id CAOR=d=0R80yiX__3KjRpO5MQ9tPcQ0vaAJsToHD5_UrZ7qP0BQ@mail.gmail.com
Whole thread Raw
In response to Re: shared_buffers formula  (Bill Moran <wmoran@potentialtech.com>)
List pgsql-general
On Wed, Mar 4, 2015 at 4:50 AM, Bill Moran <wmoran@potentialtech.com> wrote:
> On Wed, 4 Mar 2015 14:05:09 +0400
> Alexander Shutyaev <shutyaev@gmail.com> wrote:
>
>> Thanks for the answer. Now, given this info I've calculated that our
>> postgresql should occupy approx. 30,53 GB while the server has 125 GB of
>> RAM. However we often see in top that there is very little free memory and
>> even swap is used. What could be the reason of postgres using so much
>> memory?
>
> Memory usage is much more dependent on the OS than Postgres than you
> might realize. I don't see where you state the OS, but I'll assume
> it's Linux for now.
>
> Linux default NUMA policy seems to be tuned toward applications
> that don't use a lot of RAM. If your 128G server has 8 CPUs, then
> Linux will allow a single process to use 16G of RAM before deciding
> that it has to use swap for that process. This is one of the
> advantantages I find with FreeBSD.
>
> Read up on how NUMA works a bit, and do some research into how to
> tune the NUMA policies ... assuming, of course, that you _are_ using
> Linux. Or switch to FreeBSD where the default NUMA policy is more
> friendly to programs that use a lot of RAM.

The single most important step on a NUMA pg machine is to make sure
that zone_reclaim_mode = 0. If the kernel detects a largish internode
communication cost, it will turn it on at boot time and after you've
been running a while it will suddenly slow to a crawl as it tries to
move things around in memory. Other important steps are to lower the
background dirty bytes so you don't get massive background writes.


pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: Weight BLOB objects in postgreSQL? How?
Next
From: Paul Ramsey
Date:
Subject: Re: autovacuum worker running amok - and me too ;)