Re: pgstat_send_connstats() introduces unnecessary timestamp and UDP overhead

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: andres(at)anarazel(dot)de, magnus(at)hagander(dot)net, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pgstat_send_connstats() introduces unnecessary timestamp and UDP overhead
Date: 2021-08-24 10:34:25
Message-ID: 549021b774dd66fc4dddb79dc7e0c24076ec37ad.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2021-08-24 at 15:12 +0900, Kyotaro Horiguchi wrote:
> At Wed, 18 Aug 2021 05:16:38 +0200, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> wrote in
> > On Tue, 2021-08-17 at 02:14 -0700, Andres Freund wrote:
> > > > > I'm also not all that happy with sending yet another UDP packet for this.
> > > >
> > > > Are you suggesting that connection statistics should be shoehorned into
> > > > some other statistics message?  That would reduce the number of UDP packets,
> > > > but it sounds ugly and confusing to me.
> > >
> > > That ship already has sailed. Look at struct PgStat_MsgTabstat
> > >
> > > Given that we transport number of commits/commits, block read/write time
> > > adding the time the connection was active/inactive doesn't really seem like it
> > > makes things meaningfully worse?
> >
> > Point taken.
> >
> > I looked at the other statistics sent in pgstat_report_stat(), and I see
> > none that are sent unconditionally.
>
> IIUC, that means that pg_stat_report sends at least one
> PgStat_MsgTabstat struct for the database stats purpose if any stats
> are sent.  So the connection stats can piggy-back on the packet.
>
> No need to change the condition. It's sufficient that the connection
> stats are sent at the same time with transaction stats are sent.

> > > Doubling the number of UDP messages in common workloads seems also problematicenough that it should be addressed for 14.
> >
> > Ok, but I don't know how to go about it.
>
> The attached is a heavy-WIP on:
>
> - remove redundant gettimeofday().
> - avoid sending dedicate UCP packet for connection stats.

Thank you.

Perhaps I misread that, but doesn't that mean that the session statistics
could be sent several times? "pgstat_send_tabstat()" could be called more than
once, right?

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-08-24 11:08:20 Re: Failure of subscription tests with topminnow
Previous Message Michael Paquier 2021-08-24 10:28:42 Re: remove internal support in pgcrypto?