Re: pg_stat_io not tracking smgrwriteback() is confusing

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>
Subject: Re: pg_stat_io not tracking smgrwriteback() is confusing
Date: 2023-04-24 23:02:47
Message-ID: 20230424230247.idjjzdrg25njppub@liskov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 24, 2023 at 03:56:54PM -0700, Andres Freund wrote:
> Hi,
>
> On 2023-04-24 18:36:24 -0400, Melanie Plageman wrote:
> > On Mon, Apr 24, 2023 at 6:13 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
> > > > Also, it seems like this (given the current code) is only reachable for
> > > > permanent relations (i.e. not for IO object temp relation). If other
> > > backend
> > > > types than checkpointer may call smgrwriteback(), we likely have to
> > > consider
> > > > the IO context.
> > >
> > > I think we should take it into account - it'd e.g. interesting to see a
> > > COPY
> > > is bottlenecked on smgrwriteback() rather than just writing the data.
> > >
> >
> > With the quick and dirty attached patch and using your example but with a
> > pgbench -T200 on my rather fast local NVMe SSD, you can still see quite
> > a difference.
>
> Quite a difference between what?

With and without the patch. Meaning: clearly tracking writeback is a good idea.

>
> What scale of pgbench did you use?

1000, as you did

>
> -T200 is likely not a good idea, because a timed checkpoint might "interfere",
> unless you use a non-default checkpoint_timeout. A timed checkpoint won't show
> the issue as easily, because checkpointer spend most of the time sleeping.

Ah, I see. I did not use a non-default checkpoint timeout.

> > Patch needs cleanup/comments and a bit more work, but I could do with
> > a sanity check review on the approach.
>
> I was thinking we'd track writeback separately from the write, rather than
> attributing the writeback to "write". Otherwise it looks good, based on a
> quick skim.

Like you want a separate IOOp IOOP_WRITEBACK? Interesting. Okay.

- Melanie

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2023-04-24 23:18:34 Re: Request for comment on setting binary format output per session
Previous Message Andres Freund 2023-04-24 22:56:54 Re: pg_stat_io not tracking smgrwriteback() is confusing