Die Grundlagen der PostgreSQL-Ăśberwachung. Alexey Lesovsky

Und ich schlage vor, das Transkript des Berichts Alexey Lesovsky von Data Egret "Grundlagen der PostgreSQL-Ăśberwachung" zu lesen.


In diesem Bericht wird Alexei Lesovsky ĂĽber die wichtigsten Punkte der Post-Brutto-Statistik sprechen, was sie bedeuten und warum sie bei der Ăśberwachung anwesend sein sollten. darĂĽber, welche Grafiken ĂĽberwacht werden sollen, wie sie hinzugefĂĽgt und wie sie interpretiert werden. Der Bericht ist nĂĽtzlich fĂĽr Datenbankadministratoren, Systemadministratoren und Entwickler, die an Postgres Troubleshoot interessiert sind.




Mein Name ist Alexei Lesovsky, ich vertrete Data Egret.


Ein paar Worte ĂĽber dich. Ich habe einmal als Systemadministrator angefangen.


Linux, , Linux, . . , , . . - , PostgreSQL. . - PostgreSQL . PostgreSQL DBA.


, , . , Zabbix. zabbix-extensions. . , Linux, .


PostgreSQL. , PostgreSQL-. pgCenter ( — ).



. , ? - , . , : «, , - , ». , – PostgreSQL, MySQL - . : « , - . ». . , - , PostgreSQL - . - GitHub, , , - . .



, PostgreSQL, . , , - , , - , .


, , , noSQL. PostgreSQL, , PostgreSQL. , , PostgreSQL . , , , .



, . - . .
, - . , . .

, . – , . . - , . , , , , - .


, , - , . .


– , , – . , . – . . .


PostgreSQL, , . . PostgreSQL , , Stats Collector, , .


(view). . . . psql , select , - PostgreSQL.


, , .


, . -- , .

, ? , – , , .



, , , , . .



, , , , : , . . . (workload), .



, , . , , , , , , - , .



, – . , . , . , .



. , , . , , .



- , , - - . , .



– . ? – , . . , , , . . .



, . , . – .
, , . - , , - , , drilldown-, .



. . , , . « ». , , , . - , , , . , . . , , . .



? . PostgreSQL pg_stat_statements. , , . , .


, , . . – , . , PostgreSQL . - , , . . 'select 1'  , , .


, . pg_stat_database. xact_rollback. rollback, , . , . , , , .



, . . , , , , , - backend . , , - , , , .


, pg_stat_database. commit rollback  .


, ? TPS QPS .


pg_stat_statements . , , , , .



, – - downtime.


– uptime. uptime PostgreSQL – . , . PostgreSQL , uptime. - , , - , OOM-killer PostgreSQL, PostgreSQL , shared . , , . . , downtime. uptime , postmaster . .


. , autovacuum PostgreSQL? PostgreSQL. , . , , . . . , , , .


? . .


pg_stat_activity, . . , . , , PostgreSQL - .


PostgreSQL , PostgreSQL . , , . , , stat idle-in-transaction. , . – , . , , , . , , . - , , 10-20-30 OLTP-, , , . 10-20-30 – , .



. , , .


, , PostgreSQL, . , .


. . , , . .


, , , . idle.


. , , , - , , , , . . . . - (Exception), . PostgreSQL. PostgreSQL . . , .


. - . , : , - , - , . , , , - . , . , . , . . .



. . . DB connection – 8 . . , , idle, . , . . , . .

, , pg_stat_activity. PostgreSQL, , , PostgreSQL, . . . , : , , , , , . , , stat. , stats-, , stat- . .
. , , . xact_start query_start. , , . now(), timestamp . , .


, . OLTP- – 1-2-3 . OLAP- , , , - .



, . , , . , .


, , «». , , «» - SSD . , - , - «» , SATA , .


. , - . , . , . , update delete. .


«» . ? PostgreSQL . . ? , PostgreSQL , . : , NULL , .


, .


, «». , - , . . , , . , - , .. 100 ( limit 100), . .


. , explain, , . . .



. , , . Prometheus? Prometheus? , PostgreSQL – postgres_exporter Prometheus. .



. unity , . . 5 . Insert data, Update data, Delete data, Fetch data Return data.  unit . , PostgreSQL tuple (). , , – , , tuple – , tuple – , . . . tuples – . , , , .



? PostgreSQL . – pg_stat_user_tables. User_tables â€“ , , . , PostgreSQL. Alltables, , . , .


insert, update delete. , , . . , tuples, , .


, , TopN-. , Top-5, Top-10. , . , 5 «» . TopN- , .


, , , , , . .



. , ? ?



. ? . . , . , host , , . Top, PostgreSQL, - . Top , .



, , , , , , PostgreSQL , . – 80-85-90 %. . , , , , , . - , .



, . . . , , , . , . , , , . .



pg_stat_statements. . , , . . , . , , - .


, . . , . , -. total_time, mean_time, blk_write_time blk_read_time.


, , , , , - .


. , . , - , . .


, .



. – , autovacuum .



. Maintenance, , - . , . , , .



, , «» shared , . , PostgreSQL .


, «» , . , , – . - , . . .


, pg_stat_bgwriter . - ( 10-15-20 , ) , , 3-4-5, . , , . , - . , . , .



autovacuum, , , , , autovacuum.


autovacuum . , , , autovacuum , , autovacuum .
. , DBA  - , . - . , . PostgreSQL – . , , .


, , . , , , , , . , (3-4 ), . , . – . , , . , , .



PostgreSQL, . – .


PostgreSQL . . , . .


, pg_stat_replication.  . 10 . -, . . 10- , . . 10 . 10- , . . , – . .


, , . pg_stat_replication. , pg_xlog_location_diff() . . .


10- pg_wal_lsn_diff(). , , , , «xlog», «wal». , . .


10- , . write lag, flush lag, replay lag. . . . , , , , .



. , . , , swap, . .


, . , . iops . latency . , , . latency, , - . , , . , .


, /proc, . , . .


. , , latency , .



. , - . , , , - .


, , .


:


  • , , , .
  • , , .
  • , . .
  • , , . , , , . .
  • , , .
  • , , .


, .
http://bit.do/stats_collector — . . , . , .


:
http://bit.do/dataegret_sql
http://bit.do/lesovsky_sql


. . select* from - . , , , , . . , . , , , , .



: , , - – ?
: -. , . , . Zabbi. TopN-. Okmeter, . PostgreSQL . pet-project, Prometheus Grafana. Prometheus Grafana.


: - AWR- … ? - ?
: , , AWR, . , . baselines PostgreSQL . , . sql.ru  PostgreSQL. . , , . pgCenter , .


P.S.1 c postgres_exporter, ? . . m ?


P.S.2 pganalyze, is a proprietary SaaS offering which focuses on performance monitoring and automated tuning suggestions.

Source: https://habr.com/ru/post/undefined/


All Articles