Re: [HACKERS] 答复:[HACKERS] about fsync in CLOG buffer write

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: 周正中(德歌) <dege(dot)zzz(at)alibaba-inc(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, 张广舟(明虚) <guangzhou(dot)zgz(at)alibaba-inc(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, 范孝剑(康贤) <funnyxj(dot)fxj(at)alibaba-inc(dot)com>, 曾文旌(义从) <wenjing(dot)zwj(at)alibaba-inc(dot)com>, 窦贤明(执白) <xianming(dot)dxm(at)alibaba-inc(dot)com>, 萧少聪(铁庵) <shaocong(dot)xsc(at)alibaba-inc(dot)com>, 陈新坚(惧留孙) <xinjian(dot)chen(at)alibaba-inc(dot)com>
Subject: Re: [HACKERS] 答复:[HACKERS] about fsync in CLOG buffer write
Date: 2015-09-08 07:37:18
Message-ID: CAA4eK1KGb4NNN3bhkN7xhH--tM=NewsanXXyA9ooE3op8PyNdA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Sep 6, 2015 at 7:34 AM, 周正中(德歌) <dege(dot)zzz(at)alibaba-inc(dot)com> wrote:

>
> >On 2015-09-10 19:39:59 +0800, 张广舟(明虚) wrote:
> >> We found there is a fsync call when CLOG buffer
>
> >> is written out in SlruPhysicalWritePage(). It is often called when a backend
> >> needs to check transaction status with SimpleLruReadPage().
>
> >That's when there's not enough buffers available some other, and your
> >case dirty, needs to be written out.
>
> >You could try increasing the max (32) in CLOGShmemBuffers() further.
>
> I think increasing CLOGShmemBuffers have no help for our case, because
> PG will call pg_fsync once for every CLOG PAGE(BLOCKSZ) when ExtendCLOG。
>
>
Ideally that should not happen every time, CLOG page is written only
when there is no non-dirty CLOG buffer to accommodate a new page
during ExtendCLOG. I think it will happen only if there is no flush of
CLOG pages by Checkpoint or by any other process trying to commit
the transaction during last 32 pages worth of transactions (which is
4 (TRANS_PER_BYTE) * 8192 (BLKSIZE) * 32 (CLOG_BUFFERS)).

What kind of workload you are using, can you once try by commenting
the sync call and see if there is any gain (I understand that is not right,
but at least we will come to know how much we can save by moving such
a sync to checkpoint).

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message 周正中 (德歌) 2015-09-08 07:58:26 答复:[HACKERS] 答复:[HACKERS] about fsync in CLOG buffer write
Previous Message Michael Paquier 2015-09-08 07:28:02 Re: Use pg_rewind when target timeline was switched