gs_checkperf

背景信息

openGauss提供了gs_checkperf工具来帮助对openGauss级别(主机CPU占用率、Gauss CPU占用率、I/O使用情况等)、节点级别(CPU使用情况、内存使用情况、I/O使用情况)、会话/进程级别(CPU使用情况、内存使用情况、I/O使用情况)、SSD性能(写入、读取性能)进行定期检查,让用户了解openGauss的负载情况,采取对应的改进措施。

前提条件

  • openGauss运行状态正常且不为只读模式。
  • 运行在数据库之上的业务运行正常。

注意事项

  • gs_checkperf工具的监控信息依赖于pmk模式下的表的数据。如果pmk模式下的表未执行analyze操作,则可能导致gs_checkperf工具执行失败。其报错示例信息如下。

    1. LOG: Statistics in some tables or columns(pmk.pmk_snapshot.snapshot_id) are not collected.
    2. HINT: Do analyze for them in order to generate optimized plan.

    此时需要登录任一数据库主节点,连接postgres数据库执行如下SQL。

    1. analyze pmk.pmk_configuration;
    2. analyze pmk.pmk_meta_data;
    3. analyze pmk.pmk_snapshot;
    4. analyze pmk.pmk_snapshot_dbnode_stat;
    5. analyze pmk.pmk_snapshot_datanode_stat;

语法

  • 检查SSD性能(root用户)

    1. gs_checkperf -U USER [-o OUTPUT] -i SSD [-l LOGFILE]
  • 检查openGauss性能(openGauss安装用户)

    1. gs_checkperf [-U USER] [-o OUTPUT] [-i PMK] [--detail] [-l LOGFILE]
  • 显示帮助信息

    1. gs_checkperf -? | --help
  • 显示版本号信息

    1. gs_checkperf -V | --version

参数说明

  • -U

    运行openGauss的用户名称。

    取值范围:运行openGauss的用户名称。

    以root用户身份执行此命令必须指定该参数。

  • -o

    指定性能检查报告输出到指定的文件。

    取值范围:指定的文件名称。

    不指定则将检查结果输出到屏幕上。

  • -i

    指定检查项编号,-i参数值不区分大小写。格式:-i PMK、-i SSD。

    取值范围:PMK、SSD

    只有openGauss用户才能检查PMK选项。

    只有root用户才能检查SSD选项。

    如果不指定该参数,以openGauss用户身份默认检查PMK,以root用户身份默认检查SSD。

  • —detail

    显示PMK检查结果详情。

  • -l

    指定日志文件的存储路径。

    默认路径为:/var/log/gaussdb/omm/om/gs_checkperf-YYYY-MM-DD_hhmmss.log

  • -?, —help

    显示帮助信息。

  • -V, —version

    显示版本号信息。

表 1 性能检查项

分类

性能参数项

描述

openGauss级别

主机CPU占用率

主机CPU占用率。

Gauss CPU占用率

Gauss CPU占用率。

共享内存击中率

共享内存的击中率。

内存中排序比率

内存中完成的排序所占比率。

I/O使用情况

文件读写次数和时间。

磁盘使用情况

文件写次数和平均写时间、最大写时间等。

事务统计

当前SQL执行数和Session数。

节点级别

CPU使用情况

主机使用CPU情况,包括cpu busy time、cpu idle time等。

内存使用情况

主机使用内存情况,包括物理内存总量、已使用量等。

I/O使用情况

文件读写次数和时间。

会话/进程级别

CPU使用情况

会话使用CPU情况,包括cpu busy time、cpu idle time等。

内存使用情况

会话使用内存情况,包括物理内存总量、已使用量等。

I/O使用情况

会话共享缓冲区命中次数等。

SSD性能(只用root用户才能查看)

写入性能

使用dd命令(flag=direct bs=8M count=2560)向每个SSD写入内容,写入每个SSD时间应在10s左右。

读取性能

使用dd命令(flag=direct bs=8M count=2560)从每个SSD读取内容,读取每个SSD时间应在7s左右。

示例

示例一:以简要格式在屏幕上显示性能统计结果。

  1. gs_checkperf -i pmk -U omm
  2. Cluster statistics information:
  3. Host CPU busy time ratio : 1.43 %
  4. MPPDB CPU time % in busy time : 1.88 %
  5. Shared Buffer Hit ratio : 99.96 %
  6. In-memory sort ratio : 100.00 %
  7. Physical Reads : 4
  8. Physical Writes : 25
  9. DB size : 70 MB
  10. Total Physical writes : 25
  11. Active SQL count : 2
  12. Session count : 3

示例二:以详细格式在屏幕上显示性能统计结果。

  1. gs_checkperf -i pmk -U omm --detail
  2. Cluster statistics information:
  3. Host CPU usage rate:
  4. Host total CPU time : 42386.667 Jiffies
  5. Host CPU busy time : 1873.333 Jiffies
  6. Host CPU iowait time : 20.000 Jiffies
  7. Host CPU busy time ratio : 4.42 %
  8. Host CPU iowait time ratio : .05 %
  9. MPPDB CPU usage rate:
  10. MPPDB CPU time % in busy time : 19.04 %
  11. MPPDB CPU time % in total time : .84 %
  12. Shared buffer hit rate:
  13. Shared Buffer Reads : 0
  14. Shared Buffer Hits : 24129
  15. Shared Buffer Hit ratio : 100.00 %
  16. In-memory sort ratio : 100.00 %
  17. I/O usage:
  18. Number of files : 537
  19. Physical Reads : 0
  20. Physical Writes : 0
  21. Read Time : 0 ms
  22. Write Time : 0 ms
  23. Disk usage:
  24. DB size : 70 MB
  25. Total Physical writes : 0
  26. Average Physical write : 0
  27. Maximum Physical write : 0
  28. Activity statistics:
  29. Active SQL count : 2
  30. Session count : 3
  31. Node statistics information:
  32. dn_6001_6002:
  33. MPPDB CPU Time : 200 Jiffies
  34. Host CPU Busy Time : 3490 Jiffies
  35. Host CPU Total Time : 42330 Jiffies
  36. MPPDB CPU Time % in Busy Time : 5.73 %
  37. MPPDB CPU Time % in Total Time : .47 %
  38. Physical memory : 8231776256 Bytes
  39. DB Memory usage : 877236224 Bytes
  40. Shared buffer size : 33554432 Bytes
  41. Shared buffer hit ratio : 100.00 %
  42. Sorts in memory : 123
  43. Sorts in disk : 0
  44. In-memory sort ratio : 100.00 %
  45. Number of files : 149
  46. Physical Reads : 0
  47. Physical Writes : 0
  48. Read Time : 0
  49. Write Time : 0
  50. dn_6003_6004:
  51. MPPDB CPU Time : 170
  52. Jiffies Host CPU Busy Time : 1030 Jiffies
  53. Host CPU Total Time : 42470 Jiffies
  54. MPPDB CPU Time % in Busy Time : 16.50 %
  55. MPPDB CPU Time % in Total Time : .40 %
  56. Physical memory : 8231776256 Bytes
  57. DB Memory usage : 881434624 Bytes
  58. Shared buffer size : 33554432 Bytes
  59. Shared buffer hit ratio : 100.00 %
  60. Sorts in memory : 119
  61. Sorts in disk : 0
  62. In-memory sort ratio : 100.00 %
  63. Number of files : 165
  64. Physical Reads : 0
  65. Physical Writes : 0
  66. Read Time : 0
  67. Write Time : 0
  68. dn_6005_6006:
  69. MPPDB CPU Time : 220 Jiffies
  70. Host CPU Busy Time : 1100 Jiffies
  71. Host CPU Total Time : 42360 Jiffies
  72. MPPDB CPU Time % in Busy Time : 20.00 %
  73. MPPDB CPU Time % in Total Time : .52 %
  74. Physical memory : 8231776256 Bytes
  75. DB Memory usage : 881430528 Bytes
  76. Shared buffer size : 33554432 Bytes
  77. Shared buffer hit ratio : 100.00 %
  78. Sorts in memory : 122
  79. Sorts in disk : 0
  80. In-memory sort ratio : 100.00 %
  81. Number of files : 115
  82. Physical Reads : 0
  83. Physical Writes : 0
  84. Read Time : 0
  85. Write Time : 0
  86. Session statistics information(Top 10):
  87. Session CPU statistics:
  88. 1 dn_6003_6004-postgres-dbazt:
  89. Session CPU time : 1211
  90. Database CPU time : 37670
  91. Session CPU time % : 3.21 %
  92. 2 dn_6005_6006-postgres-dbazt:
  93. Session CPU time : 1204
  94. Database CPU time : 35730
  95. Session CPU time % : 3.37 %
  96. 3 dn_6001_6002-postgres-dbazt:
  97. Session CPU time : 1064
  98. Database CPU time : 34120
  99. Session CPU time % : 3.12 %
  100. Session Memory statistics:
  101. 1 dn_6005_6006-postgres-dbazt:
  102. Buffer Reads : 8989
  103. Shared Buffer Hit ratio : 96.97
  104. In Memory sorts : 136
  105. In Disk sorts : 0
  106. In Memory sorts ratio : 100.00
  107. Total Memory Size : 21593048
  108. Used Memory Size : 18496600
  109. 2 dn_6003_6004-postgres-dbazt:
  110. Buffer Reads : 9030
  111. Shared Buffer Hit ratio : 96.94
  112. In Memory sorts : 133
  113. In Disk sorts : 0
  114. In Memory sorts ratio : 100.00
  115. Total Memory Size : 21576664
  116. Used Memory Size : 18495688
  117. 3 dn_6001_6002-postgres-dbazt:
  118. Buffer Reads : 8668
  119. Shared Buffer Hit ratio : 96.97
  120. In Memory sorts : 138
  121. In Disk sorts : 0
  122. In Memory sorts ratio : 100.00
  123. Total Memory Size : 21258856
  124. Used Memory Size : 18159736
  125. Session IO statistics:
  126. 1 dn_6003_6004-postgres-dbazt:
  127. Physical Reads : 285
  128. Read Time : 5320
  129. 2 dn_6005_6006-postgres-dbazt:
  130. Physical Reads : 281
  131. Read Time : 5811
  132. 3 dn_6001_6002-postgres-dbazt:
  133. Physical Reads : 271
  134. Read Time : 4662

相关命令

gs_checkgs_checkos