Re: pgstat_send_connstats() introduces unnecessary timestamp and UDP overhead
Kyotaro Horiguchi <horikyota.ntt@gmail.com>
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: michael@paquier.xyz
Cc: laurenz.albe@cybertec.at, andres@anarazel.de, magnus@hagander.net,
pgsql-hackers@postgresql.org
Date: 2021-08-25T05:59:37Z
Lists: pgsql-hackers
Attachments
- (unnamed) (text/plain)
At Wed, 25 Aug 2021 13:21:52 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in > At Wed, 25 Aug 2021 12:51:58 +0900, Michael Paquier <michael@paquier.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
Commits
-
Fix performance regression from session statistics.
- 7890a423470b 14.0 landed
- 37a9aa659111 15.0 landed
-
Add pg_stat_database counters for sessions and session time
- 960869da0803 14.0 cited