Re: pgstat_send_connstats() introduces unnecessary timestamp and UDP overhead

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: michael(at)paquier(dot)xyz
Cc: laurenz(dot)albe(at)cybertec(dot)at, 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-25 05:59:37
Message-ID: 20210825.145937.1005974779513969180.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Wed, 25 Aug 2021 13:21:52 +0900 (JST), Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> wrote in
> At Wed, 25 Aug 2021 12:51:58 +0900, Michael Paquier <michael(at)paquier(dot)xyz> wrote in
> > - Throttle the frequency where the connection stat packages are sent,
> > as of [2].
> >
> > Magnus, this open item is assigned to you as the committer of
> > 960869d. Could you comment on those issues?
> >
> > [1]: https://www.postgresql.org/message-id/4095ceb328780d1bdba77ac6d9785fd7577ed047.camel@cybertec.at
> > [2]: https://www.postgresql.org/message-id/20210801205501.nyxzxoelqoo4x2qc@alap3.anarazel.de
>
> About [2], we need to maintain session active/idel times on additional
> menbers in backend status. Letting gpgstat_report_activity to
> directly scribble on backend status array would work?

So the attached is roughly that (just a PoC, of course).

- accumulate active and idle time on backend status array.
(pgstat_report_activity)

- pgstat_get_db_session_time() and friends read pgstat file then sum
up relevant members in backend status array. (So it scans on the
array for every number of every database X().

- The function pgstat_send_connstats is called only at the end of a
connection. It reads backend status element then send the numbers
to stats collector. pgstat_shutdown_hook needs to be moved from
on_shmem_exit to before_shmem_exit to read MyBEEntry.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-08-25 06:22:04 Re: Failure of subscription tests with topminnow
Previous Message Drouvot, Bertrand 2021-08-25 05:55:47 Re: [bug] Logical Decoding of relation rewrite with toast does not reset toast_hash