percona / pg_stat_monitor

Query Performance Monitoring Tool for PostgreSQL
https://docs.percona.com/pg-stat-monitor/
Other
466 stars 59 forks source link

[PG-644] Add option to disable application name tracking #469

Closed artemgavrilov closed 1 month ago

artemgavrilov commented 2 months ago

PG-644

This PR introduces two changes:

  1. It uses new functions for PG 16 and 17 for getting backend status that allow to avoid iteration over be status table.
  2. It adds new parameter pgsm_track_application_names that allows to disable application name tracking

It turned out that taking application name is expensive operation, it requires locking inside PG. This causes performance dramatically on big amount of connections. For example on TPC-C benchmark with 512 threads PGSM with application name tracking (default) gives -15% QPS, while without tracking only -3% QPS.

Docs PR: https://github.com/percona/pgsm-docs/pull/63

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 84.99%. Comparing base (dacb41f) to head (63f274a).

Files Patch % Lines
pg_stat_monitor.c 75.00% 0 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #469 +/- ## ========================================== + Coverage 84.82% 84.99% +0.16% ========================================== Files 3 3 Lines 1292 1293 +1 Branches 196 197 +1 ========================================== + Hits 1096 1099 +3 + Misses 99 98 -1 + Partials 97 96 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.