From: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
---|---|
To: | Bill Moran <wmoran(at)potentialtech(dot)com> |
Cc: | Alexander Shutyaev <shutyaev(at)gmail(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: shared_buffers formula |
Date: | 2015-03-04 16:44:57 |
Message-ID: | CAOR=d=0R80yiX__3KjRpO5MQ9tPcQ0vaAJsToHD5_UrZ7qP0BQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Mar 4, 2015 at 4:50 AM, Bill Moran <wmoran(at)potentialtech(dot)com> wrote:
> On Wed, 4 Mar 2015 14:05:09 +0400
> Alexander Shutyaev <shutyaev(at)gmail(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Paul Ramsey | 2015-03-04 16:48:53 | Re: autovacuum worker running amok - and me too ;) |
Previous Message | Bill Moran | 2015-03-04 16:12:42 | Re: Weight BLOB objects in postgreSQL? How? |