Re: overcommit_ratio setting

From: Yi Sun <yinan81(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: overcommit_ratio setting
Date: 2021-06-15 07:45:59
Message-ID: CABWY_HAD5wJOmTZQQe2_TENsCbbXWvT1S2TSDPbDiNjkb9uvBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> 于2021年6月15日周二 下午3:07写道:

> On Tue, 2021-06-15 at 08:34 +0800, Yi Sun wrote:
> > > overcommit_ratio < (RAM - swap) / RAM * 100
> > >
> > > Here, RAM is the RAM available to PostgreSQL.
> >
> > Thank you for your reply
> >
> > 1. Our env RAM are 4GB, 8 GB, 16 GB... as below url suggestion, could we
> configure swap as below?
> > https://opensource.com/article/18/9/swap-space-linux-systems
> >
> > RAM swap
> >
> > 2GB – 8GB = RAM
> > >8GB 8GB
>
> I wouldn't change the swap space to fit overcommit_ratio, but
> the other way around.
> With a properly configured PostgreSQL, you won't need a lot of swap space.
>
> > 2. If the RAM is 4GB and 8GB, the formula (RAM - swap) / RAM * 100
> result will become to 0,
> > how could we configure overcommit_ratio please?
>
> You have to use floating point arithmetic.
>
> The result will only be 0 if RAM = swap.
>

Got it, so should always use formula overcommit_ratio < (RAM - swap) / RAM
* 100 regardless of the value

Our prd env RAM are 4GB, 8 GB, 16 GB..., some env configured swap, some env
didn't configure swap
1. Is it OK if prd env didn't configure swap?
2. The linux OS is CentOS 7, what's the recommended value for swap setting
based on different RAM please?

Thank you

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Rory Campbell-Lange 2021-06-15 12:05:18 Re: Master - Slave Replication Window Server
Previous Message Laurenz Albe 2021-06-15 07:07:00 Re: overcommit_ratio setting