From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Vitaliy Garnashevich <vgarnashevich@gmail.com>
To: pgsql-general@postgresql.org
Subject: Re: shared_buffers 8GB maximum
Date: Sun, 18 Feb 2018 15:16:46 +0100
Message-ID: <308ca303-a0c2-753c-d2d2-227db241cad7@2ndquadrant.com> (raw)
In-Reply-To: <688b6a68-bcaf-5658-8b94-fa5720c74d7c@gmail.com>
References: <d9eeeeff-5983-0a67-9852-d6903ca2a618@gmail.com>
<7tve8ddg1lcf4uejigos0j71kkjd488jad@4ax.com>
<30ec3be0-a4b2-edb6-87f9-8874afe9d818@2ndquadrant.com>
<688b6a68-bcaf-5658-8b94-fa5720c74d7c@gmail.com>
On 02/18/2018 02:41 PM, Vitaliy Garnashevich wrote:
>
>> I certainly wouldn't recommend using 1/2 of RAM right away. There's
>> a good chance it would be a waste of memory - for example due to
>> double buffering, which effectively reduces "total" cache hit
>> ratio.
>
> Double buffering is often mentioned in context of tuning shared
> buffers. Is there a tool to actually measure the amount of double
> buffering happening in the system?
>
I'm not aware of such tool. But I suppose it could be done by
integrating information from pg_buffercache and pgfincore [1].
[1] https://github.com/klando/pgfincore>> Those evictions are performed either by backends or bgwriter, both
>> of which are less efficient than checkpointer. Not only can
>> checkpointer perform various optimizations (e.g. sorting buffers to
>> make the writes more sequential), but it also writes each dirty
>> buffer just once. With smaller shared_buffers the page may have be
>> written multiple times.
>
> In the case when shared_buffers cover most of RAM, most of writes
> should happen by checkpointer, and cache hit ratio should be high. So
> a hypothetical question: Could shared_buffers=200GB on a 250 GB RAM
> server ever be a reasonable setting? (assuming there are no other
> applications running except postgres, and 50GB is enough for
> allocating work_mem/maintenance_work_mem and for serving queries)
>
It depends on how large is the active part of the data set is. If it
fits into 200GB but not to smaller shared buffers (say, 100GB), then
using 200GB may be a win.
If the active set is much larger than RAM, smaller shared_buffer values
work better in my experience.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tomas.vondra@2ndquadrant.com, vgarnashevich@gmail.com
Subject: Re: shared_buffers 8GB maximum
In-Reply-To: <308ca303-a0c2-753c-d2d2-227db241cad7@2ndquadrant.com>
References: <d9eeeeff-5983-0a67-9852-d6903ca2a618@gmail.com> <7tve8ddg1lcf4uejigos0j71kkjd488jad@4ax.com> <30ec3be0-a4b2-edb6-87f9-8874afe9d818@2ndquadrant.com> <688b6a68-bcaf-5658-8b94-fa5720c74d7c@gmail.com> <308ca303-a0c2-753c-d2d2-227db241cad7@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox