doc-exports/docs/dws/dev/dws_04_0396.html
Lu, Huayi a24ca60074 DWS DEVELOPER 811 version
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2023-01-19 13:37:49 +00:00

83 lines
16 KiB
HTML

<a name="EN-US_TOPIC_0000001098655162"></a><a name="EN-US_TOPIC_0000001098655162"></a>
<h1 class="topictitle1">Instance Resource Monitoring</h1>
<div id="body1578984302436"><p id="EN-US_TOPIC_0000001098655162__p8060118"><span id="EN-US_TOPIC_0000001098655162__text1792255594">GaussDB(DWS)</span> provides system catalogs for monitoring the resource usage of CNs and DNs (including memory, CPU usage, disk I/O, process physical I/O, and process logical I/O), and system catalogs for monitoring the resource usage of the entire cluster. </p>
<p id="EN-US_TOPIC_0000001098655162__p224164813213">For details about the system catalog <strong id="EN-US_TOPIC_0000001098655162__b6890104516260">GS_WLM_INSTANCE_HISTORY</strong>, see <a href="dws_04_0564.html">GS_WLM_INSTANCE_HISTORY</a>.</p>
<div class="note" id="EN-US_TOPIC_0000001098655162__n7a9652a1f8594abf8cd88b657df7f214"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001098655162__p76172316405">Data in the system catalog<strong id="EN-US_TOPIC_0000001098655162__b693818112713">GS_WLM_INSTANCE_HISTORY</strong> is distributed in corresponding instances. CN monitoring data is stored in the CN instance, and DN monitoring data is stored in the DN instance. The DN has a standby node. When the primary DN is abnormal, the monitoring data of the DN can be restored from the standby node. However, a CN has no standby node. When a CN is abnormal and then restored, the monitoring data of the CN will be lost. </p>
</div></div>
<div class="section" id="EN-US_TOPIC_0000001098655162__section294833216156"><h4 class="sectiontitle">Procedure</h4><ul id="EN-US_TOPIC_0000001098655162__ul11778104193915"><li id="EN-US_TOPIC_0000001098655162__li1177811433911">Query the latest resource usage of the current instance.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001098655162__sd8c93121e8bc4d41bc15666d44477a5f"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">GS_WLM_INSTANCE_HISTORY</span><span class="w"> </span><span class="k">ORDER</span><span class="w"> </span><span class="k">BY</span><span class="w"> </span><span class="k">TIMESTAMP</span><span class="w"> </span><span class="k">DESC</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001098655162__a22a51664352e4867951ae2fb0e745c21">The query result is as follows:</p>
<pre class="screen" id="EN-US_TOPIC_0000001098655162__screen16479038113515">instancename | timestamp | used_cpu | free_mem | used_mem | io_await | io_util | disk_read | disk_write | process_read | process_write | logical_read | logical_write | read_counts | write_counts
--------------+-------------------------------+----------+----------+----------+----------+----------+-----------+------------+--------------+---------------+--------------+---------------+-------------+--------------
dn_6015_6016 | 2020-01-10 17:29:17.329495+08 | 0 | 14570 | 8982 | 662.923 | 99.9601 | 697666 | 93655.5 | 183104 | 30082 | 285659 | 30079 | 357717 | 37667
dn_6015_6016 | 2020-01-10 17:29:07.312049+08 | 0 | 14578 | 8974 | 883.102 | 99.9801 | 756228 | 81417.4 | 189722 | 30786 | 285681 | 30780 | 358103 | 38584
dn_6015_6016 | 2020-01-10 17:28:57.284472+08 | 0 | 14583 | 8969 | 727.135 | 99.9801 | 648581 | 88799.6 | 177120 | 31176 | 252161 | 31175 | 316085 | 39079
dn_6015_6016 | 2020-01-10 17:28:47.256613+08 | 0 | 14591 | 8961 | 679.534 | 100.08 | 655360 | 169962 | 179404 | 30424 | 242002 | 30422 | 303351 | 38136</pre>
</li></ul>
</div>
<ul id="EN-US_TOPIC_0000001098655162__ul168806617193"><li id="EN-US_TOPIC_0000001098655162__li388010614192">Query the resource usage of the current instance during a specified period.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001098655162__screen1288012617199"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">GS_WLM_INSTANCE_HISTORY</span><span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="k">TIMESTAMP</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="s1">'2020-01-10'</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="k">TIMESTAMP</span><span class="w"> </span><span class="o">&lt;</span><span class="w"> </span><span class="s1">'2020-01-11'</span><span class="w"> </span><span class="k">ORDER</span><span class="w"> </span><span class="k">BY</span><span class="w"> </span><span class="k">TIMESTAMP</span><span class="w"> </span><span class="k">DESC</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001098655162__p13880563191">The query result is as follows:</p>
<pre class="screen" id="EN-US_TOPIC_0000001098655162__screen10616456362">instancename | timestamp | used_cpu | free_mem | used_mem | io_await | io_util | disk_read | disk_write | process_read | process_write | logical_read | logical_write | read_counts | write_counts
--------------+-------------------------------+----------+----------+----------+----------+----------+-----------+------------+--------------+---------------+--------------+---------------+-------------+--------------
dn_6015_6016 | 2020-01-10 17:29:17.329495+08 | 0 | 14570 | 8982 | 662.923 | 99.9601 | 697666 | 93655.5 | 183104 | 30082 | 285659 | 30079 | 357717 | 37667
dn_6015_6016 | 2020-01-10 17:29:07.312049+08 | 0 | 14578 | 8974 | 883.102 | 99.9801 | 756228 | 81417.4 | 189722 | 30786 | 285681 | 30780 | 358103 | 38584
dn_6015_6016 | 2020-01-10 17:28:57.284472+08 | 0 | 14583 | 8969 | 727.135 | 99.9801 | 648581 | 88799.6 | 177120 | 31176 | 252161 | 31175 | 316085 | 39079
dn_6015_6016 | 2020-01-10 17:28:47.256613+08 | 0 | 14591 | 8961 | 679.534 | 100.08 | 655360 | 169962 | 179404 | 30424 | 242002 | 30422 | 303351 | 38136</pre>
</li></ul>
<ul id="EN-US_TOPIC_0000001098655162__ul7146101762717"><li id="EN-US_TOPIC_0000001098655162__li10471518133416">To query the latest resource usage of a cluster, you can invoke the <strong id="EN-US_TOPIC_0000001098655162__b129982319210">pgxc_get_wlm_current_instance_info</strong> stored procedure on the CN.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001098655162__screen1214615179271"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pgxc_get_wlm_current_instance_info</span><span class="p">(</span><span class="s1">'ALL'</span><span class="p">);</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001098655162__p181461017172719">The query result is as follows:</p>
<pre class="screen" id="EN-US_TOPIC_0000001098655162__screen1416817833711">instancename | timestamp | used_cpu | free_mem | used_mem | io_await | io_util | disk_read | disk_write | process_read | process_write | logical_read | logical_write | read_counts | write_counts
--------------+-------------------------------+----------+----------+----------+----------+---------+-----------+------------+--------------+---------------+--------------+---------------+-------------+--------------
coordinator2 | 2020-01-14 21:58:29.290894+08 | 0 | 12010 | 278 | 16.0445 | 7.19561 | 184.431 | 27959.3 | 0 | 10 | 0 | 0 | 0 | 0
coordinator3 | 2020-01-14 21:58:27.567655+08 | 0 | 12000 | 288 | .964557 | 3.40659 | 332.468 | 3375.02 | 26 | 13 | 0 | 0 | 0 | 0
datanode1 | 2020-01-14 21:58:23.900321+08 | 0 | 11899 | 389 | 1.17296 | 3.25 | 329.6 | 2870.4 | 28 | 8 | 13 | 3 | 18 | 6
datanode2 | 2020-01-14 21:58:32.832989+08 | 0 | 11904 | 384 | 17.948 | 8.52148 | 214.186 | 25894.1 | 28 | 10 | 13 | 3 | 18 | 6
datanode3 | 2020-01-14 21:58:24.826694+08 | 0 | 11894 | 394 | 1.16088 | 3.15 | 328 | 2868.8 | 25 | 10 | 13 | 3 | 18 | 6
coordinator1 | 2020-01-14 21:58:33.367649+08 | 0 | 11988 | 300 | 9.53286 | 10.05 | 43.2 | 55232 | 0 | 0 | 0 | 0 | 0 | 0
coordinator1 | 2020-01-14 21:58:23.216645+08 | 0 | 11988 | 300 | 1.17085 | 3.21182 | 324.729 | 2831.13 | 8 | 13 | 0 | 0 | 0 | 0
(7 rows)</pre>
</li></ul>
<ul id="EN-US_TOPIC_0000001098655162__ul496451205915"><li id="EN-US_TOPIC_0000001098655162__li1815152519326">To query historical resource usage of a cluster, you can invoke the <strong id="EN-US_TOPIC_0000001098655162__b8517243162112">pgxc_get_wlm_current_instance_info</strong> stored procedure on the CN.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001098655162__screen1396421225919"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pgxc_get_wlm_history_instance_info</span><span class="p">(</span><span class="s1">'ALL'</span><span class="p">,</span><span class="w"> </span><span class="s1">'2020-01-14 21:00:00'</span><span class="p">,</span><span class="w"> </span><span class="s1">'2020-01-14 22:00:00'</span><span class="p">,</span><span class="w"> </span><span class="mi">3</span><span class="p">);</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001098655162__p13965812135915">The query result is as follows:</p>
<pre class="screen" id="EN-US_TOPIC_0000001098655162__screen17343133713710">instancename | timestamp | used_cpu | free_mem | used_mem | io_await | io_util | disk_read | disk_write | process_read | process_write | logical_read | logical_write | read_counts | write_counts
--------------+-------------------------------+----------+----------+----------+----------+-----------+-----------+------------+--------------+---------------+--------------+---------------+-------------+--------------
coordinator2 | 2020-01-14 21:50:49.778902+08 | 0 | 12020 | 268 | .127371 | .789211 | 15.984 | 3994.41 | 0 | 0 | 0 | 0 | 0 | 0
coordinator2 | 2020-01-14 21:53:49.043646+08 | 0 | 12018 | 270 | 30.2902 | 8.65404 | 276.77 | 16741.8 | 3 | 1 | 0 | 0 | 0 | 0
coordinator2 | 2020-01-14 21:57:09.202654+08 | 0 | 12018 | 270 | .16051 | .979021 | 59.9401 | 5596 | 0 | 0 | 0 | 0 | 0 | 0
coordinator3 | 2020-01-14 21:38:48.948646+08 | 0 | 12012 | 276 | .0769231 | .00999001 | 0 | 35.1648 | 0 | 1 | 0 | 0 | 0 | 0
coordinator3 | 2020-01-14 21:40:29.061178+08 | 0 | 12012 | 276 | .118421 | .0199601 | 0 | 970.858 | 0 | 0 | 0 | 0 | 0 | 0
coordinator3 | 2020-01-14 21:50:19.612777+08 | 0 | 12010 | 278 | 24.411 | 11.7665 | 8.78244 | 44641.1 | 0 | 0 | 0 | 0 | 0 | 0
datanode1 | 2020-01-14 21:49:42.758649+08 | 0 | 11909 | 379 | .798776 | 8.02 | 51.2 | 20924.8 | 0 | 0 | 0 | 0 | 0 | 0
datanode1 | 2020-01-14 21:49:52.760188+08 | 0 | 11909 | 379 | 23.8972 | 14.1 | 0 | 74760 | 0 | 0 | 0 | 0 | 0 | 0
datanode1 | 2020-01-14 21:50:22.769226+08 | 0 | 11909 | 379 | 39.5868 | 7.4 | 0 | 19760.8 | 0 | 0 | 0 | 0 | 0 | 0
datanode2 | 2020-01-14 21:58:02.826185+08 | 0 | 11905 | 383 | .351648 | .32 | 20.8 | 504.8 | 0 | 0 | 0 | 0 | 0 | 0
datanode2 | 2020-01-14 21:56:42.80793+08 | 0 | 11906 | 382 | .559748 | .04 | 0 | 326.4 | 0 | 0 | 0 | 0 | 0 | 0
datanode2 | 2020-01-14 21:45:21.632407+08 | 0 | 11901 | 387 | 12.1313 | 4.55544 | 3.1968 | 45177.2 | 0 | 0 | 0 | 0 | 0 | 0
datanode3 | 2020-01-14 21:58:14.823317+08 | 0 | 11898 | 390 | .378205 | .99 | 48 | 23353.6 | 0 | 0 | 0 | 0 | 0 | 0
datanode3 | 2020-01-14 21:47:50.665028+08 | 0 | 11901 | 387 | 1.07494 | 1.19 | 0 | 15506.4 | 0 | 0 | 0 | 0 | 0 | 0
datanode3 | 2020-01-14 21:51:21.720117+08 | 0 | 11903 | 385 | 10.2795 | 3.11 | 0 | 11031.2 | 0 | 0 | 0 | 0 | 0 | 0
coordinator1 | 2020-01-14 21:42:59.121945+08 | 0 | 12020 | 268 | .0857143 | .0699301 | 0 | 6579.02 | 0 | 0 | 0 | 0 | 0 | 0
coordinator1 | 2020-01-14 21:41:49.042646+08 | 0 | 12020 | 268 | 20.9039 | 11.3786 | 6042.76 | 57903.7 | 0 | 0 | 0 | 0 | 0 | 0
coordinator1 | 2020-01-14 21:41:09.007652+08 | 0 | 12020 | 268 | .0446429 | .03996 | 0 | 1109.29 | 0 | 0 | 0 | 0 | 0 | 0
(18 rows)</pre>
</li></ul>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0393.html">Resource Monitoring</a></div>
</div>
</div>