Re: Why shared_buffers max is 8GB?

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Markella Skempri <markella_skembri(at)hotmail(dot)com>
Cc: desmodemone <desmodemone(at)gmail(dot)com>, ik(at)postgresql-consulting(dot)com, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>, Alexey Vasiliev <leopard_ne(at)inbox(dot)ru>
Subject: Re: Why shared_buffers max is 8GB?
Date: 2014-03-26 14:23:49
Message-ID: CAOR=d=1qHbQE=7Dq6co_mmbX=GMt_K6AZZ5_3T6akYQ35N9A4Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, Mar 26, 2014 at 6:21 AM, Alexey Vasiliev <leopard_ne(at)inbox(dot)ru> wrote:
> I read from several sources, what maximum shared_buffers is 8GB.
>
> Does this true? If yes, why exactly this number is maximum number of
> shared_buffers for good performance (on Linux 64-bits)?

On most machines the limit is higher than you'd ever want to set it. I
have a set of servers with 1TB RAM and shared buffers on them is set
to 10G and even that is probably higher than it needs to be. The old
1/4 of memory advice comes from the days when db server memory was in
the 1 to 16GB range and even then it was more of a starting place. It
has been found through experience and experiment that few setups can
use more shared buffers than a few gigabytes and get better
performance.

On Wed, Mar 26, 2014 at 7:24 AM, Markella Skempri
<markella_skembri(at)hotmail(dot)com> wrote:
> I wanted to follow up from this question. I'm running on 9.3.4
> My DB server has 32GB ram so I have assigned 8GB shared_buffer_memory. It is
> quite a big db but with not much traffic. When there is traffic, it's
> usually big.
>
> Lately, the kernel has been killing the postmaster for having assigned too
> much shared memory. Latest crash was when loading a 500MB file.
>
> Should I reduce the shared buffers in order for this to be more robust?

It's not JUST your shared_buffers here. What are your changed settings
in postgresql.conf? Specifically work_mem, max_connections,
temp_buffers and to a lesser extent maintenance_work_mem.

Here's the thing. If you set shared_buffers, work_mem, and
max_connections too low you get a minor problem. Some apps can't
connect, pg is a little slow. If you set them too high you start
killing your DB with the OOM killer which is a major problem.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message desmodemone 2014-03-26 14:23:59 Re: Why shared_buffers max is 8GB?
Previous Message Martin French 2014-03-26 14:04:45 Re: Why shared_buffers max is 8GB?