Search Postgresql Archives

Re: shared_buffers formula

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 4, 2015 at 4:50 AM, Bill Moran <wmoran@xxxxxxxxxxxxxxxxx> wrote:
> On Wed, 4 Mar 2015 14:05:09 +0400
> Alexander Shutyaev <shutyaev@xxxxxxxxx> 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.


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux