Hello!
I installed PMM server version 3. On a highly loaded test server running PostgreSQL version 14, I installed the PMM agent version 3 and pg_stat_monitor 2.2. Metrics are being received.
Agent settings:
pg_stat_monitor.pgsm_bucket_time: 60
pg_stat_monitor.pgsm_enable_overflow: true
pg_stat_monitor.pgsm_enable_pgsm_query_id: false
pg_stat_monitor.pgsm_enable_query_plan: true
pg_stat_monitor.pgsm_histogram_max: 30000
pg_stat_monitor.pgsm_histogram_min: 50
pg_stat_monitor.pgsm_max: 512
pg_stat_monitor.pgsm_max_buckets: 20
pg_stat_monitor.pgsm_normalized_query: true
pg_stat_monitor.pgsm_query_shared_buffer: 384
pg_stat_monitor.pgsm_track_application_names: false
pg_stat_monitor.pgsm_track_planning: false
Under high load on PostgreSQL, when QPS exceeds 10K, errors occur:
caller=postgres_exporter.go:770 level=error err=āError opening connection to database (postgres://sa_percona_monitoring:PASSWORD_REMOVED@localhost:5432/base_1?connect_timeout=1&sslmode=disable): read tcp 127.0.0.1:34926->127.0.0.1:5432: i/o timeoutā" agentID=25836318-331d-4630-9cf8-7b739b9c5f4f component=agent-process type=postgres_exporter
caller=postgres_exporter.go:770 level=error err=āError opening connection to database (postgres://sa_percona_monitoring:PASSWORD_REMOVED@localhost:5432/base_2?connect_timeout=1&sslmode=disable): read tcp 127.0.0.1:34944->127.0.0.1:5432: i/o timeoutā" agentID=25836318-331d-4630-9cf8-7b739b9c5f4f component=agent-process type=postgres_exporter
Additionally, there are gaps in the graphs. PostgreSQL metrics are missing in PMM. At the moment when the metrics from pg_stat_monitor disappear, work with PostgreSQL continues - the services send requests and receive responses from the database.
The following messages are appearing in the PostgreSQL logs:
LOG: temporary file: path ābase/pgsql_tmp/pgsql_tmp3145589.7ā, size 314170608
STATEMENT: SELECT /* agent=āpgstatmonitorā */ āpg_stat_monitorā.ābucketā, āpg_stat_monitorā.āclient_ipā, āpg_stat_monitorā.āqueryā, āpg_stat_monitorā.ācallsā, āpg_stat_monitorā.āshared_blks_hitā, āpg_stat_monitorā.āshared_blks_readā, āpg_stat_monitorā.āshared_blks_dirtiedā, āpg_stat_monitorā.āshared_blks_writtenā, āpg_stat_monitorā.ālocal_blks_hitā, āpg_stat_monitorā.ālocal_blks_readā, āpg_stat_monitorā.ālocal_blks_dirtiedā, āpg_stat_monitorā.ālocal_blks_writtenā, āpg_stat_monitorā.ātemp_blks_readā, āpg_stat_monitorā.ātemp_blks_writtenā, āpg_stat_monitorā.āresp_callsā, āpg_stat_monitorā.ācpu_user_timeā, āpg_stat_monitorā.ācpu_sys_timeā, āpg_stat_monitorā.ārowsā, āpg_stat_monitorā.ārelationsā, āpg_stat_monitorā.ādatnameā, āpg_stat_monitorā.āuseridā, āpg_stat_monitorā.ātop_queryidā, āpg_stat_monitorā.āplanidā, āpg_stat_monitorā.āquery_planā, āpg_stat_monitorā.ātop_queryā, āpg_stat_monitorā.āapplication_nameā, āpg_stat_monitorā.ācmd_typeā, āpg_stat_monitorā.ācmd_type_textā, āpg_stat_monitorā.āelevelā, āpg_stat_monitorā.āsqlcodeā, āpg_stat_monitorā.āmessageā, āpg_stat_monitorā.āpgsm_query_idā, āpg_stat_monitorā.ādbidā, āpg_stat_monitorā.āblk_read_timeā, āpg_stat_monitorā.āblk_write_timeā, āpg_stat_monitorā.ātotal_exec_timeā, āpg_stat_monitorā.āmin_exec_timeā, āpg_stat_monitorā.āmax_exec_timeā, āpg_stat_monitorā.āmean_exec_timeā, āpg_stat_monitorā.āstddev_exec_timeā, āpg_stat_monitorā.ātotal_plan_timeā, āpg_stat_monitorā.āmin_plan_timeā, āpg_stat_monitorā.āmax_plan_timeā, āpg_stat_monitorā.āmean_plan_timeā, āpg_stat_monitorā.āwal_recordsā, āpg_stat_monitorā.āwal_fpiā, āpg_stat_monitorā.āwal_bytesā, āpg_stat_monitorā.āplansā, āpg_stat_monitorā.ācommentsā, āpg_stat_monitorā.ābucket_start_timeā, āpg_stat_monitorā.āusernameā FROM āpg_stat_monitorā WHERE queryid IS NOT NULL AND query IS NOT NULL AND bucket_done AND pgsm_query_id IS NOT NULL
WARNING: [pg_stat_monitor] pgsm_store: Hash table is out of memory and can no longer store queries!
DETAIL: You may reset the view or when the buckets are deallocated, pg_stat_monitor will resume saving queries. Alternatively, try increasing the value of pg_stat_monitor.pgsm_max.
WARNING: [pg_stat_monitor] pg_stat_monitor_internal: Hash table is out of memory and can no longer store queries!
DETAIL: You may reset the view or when the buckets are deallocated, pg_stat_monitor will resume saving queries. Alternatively, try increasing the value of pg_stat_monitor.pgsm_max.