{"id":173537,"date":"2024-11-07T18:51:19","date_gmt":"2024-11-07T10:51:19","guid":{"rendered":"https:\/\/server.hk\/cnblog\/173537\/"},"modified":"2024-11-07T18:51:20","modified_gmt":"2024-11-07T10:51:20","slug":"%e5%a6%82%e4%bd%95%e7%9b%a3%e6%b8%ac%e6%95%b8%e6%93%9a%e5%ba%ab%e6%9c%8d%e5%8b%99%e5%99%a8%ef%bc%9f-%e6%95%b8%e6%93%9a%e5%ba%ab%e6%9c%8d%e5%8b%99%e5%99%a8%e7%9b%a3%e6%b8%ac","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/173537\/","title":{"rendered":"\u5982\u4f55\u76e3\u6e2c\u6578\u64da\u5eab\u670d\u52d9\u5668\uff1f (\u6578\u64da\u5eab\u670d\u52d9\u5668\u76e3\u6e2c)"},"content":{"rendered":"<h1 id=\"%e5%a6%82%e4%bd%95%e7%9b%a3%e6%b8%ac%e6%95%b8%e6%93%9a%e5%ba%ab%e6%9c%8d%e5%8b%99%e5%99%a8%ef%bc%9f-%e6%95%b8%e6%93%9a%e5%ba%ab%e6%9c%8d%e5%8b%99%e5%99%a8%e7%9b%a3%e6%b8%ac-AOfLLdrMZE\">\u5982\u4f55\u76e3\u6e2c\u6578\u64da\u5eab\u670d\u52d9\u5668\uff1f (\u6578\u64da\u5eab\u670d\u52d9\u5668\u76e3\u6e2c)<\/h1>\n<p>\u5728\u7576\u4eca\u6578\u64da\u9a45\u52d5\u7684\u4e16\u754c\u4e2d\uff0c\u6578\u64da\u5eab\u670d\u52d9\u5668\u7684\u7a69\u5b9a\u6027\u548c\u6027\u80fd\u5c0d\u65bc\u4f01\u696d\u7684\u904b\u71df\u81f3\u95dc\u91cd\u8981\u3002\u6709\u6548\u7684\u6578\u64da\u5eab\u76e3\u6e2c\u53ef\u4ee5\u5e6b\u52a9\u7ba1\u7406\u54e1\u53ca\u6642\u767c\u73fe\u554f\u984c\uff0c\u512a\u5316\u6027\u80fd\uff0c\u4e26\u78ba\u4fdd\u6578\u64da\u7684\u5b89\u5168\u6027\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u6578\u64da\u5eab\u670d\u52d9\u5668\u76e3\u6e2c\u7684\u5fc5\u8981\u6027\u3001\u5e38\u7528\u7684\u76e3\u6e2c\u6307\u6a19\u4ee5\u53ca\u4e00\u4e9b\u5be6\u7528\u7684\u76e3\u6e2c\u5de5\u5177\u3002<\/p>\n<h2 id=\"%e7%82%ba%e4%bb%80%e9%ba%bc%e9%9c%80%e8%a6%81%e7%9b%a3%e6%b8%ac%e6%95%b8%e6%93%9a%e5%ba%ab%e6%9c%8d%e5%8b%99%e5%99%a8%ef%bc%9f-AOfLLdrMZE\">\u70ba\u4ec0\u9ebc\u9700\u8981\u76e3\u6e2c\u6578\u64da\u5eab\u670d\u52d9\u5668\uff1f<\/h2>\n<p>\u6578\u64da\u5eab\u670d\u52d9\u5668\u662f\u5b58\u5132\u548c\u7ba1\u7406\u6578\u64da\u7684\u6838\u5fc3\u7d44\u4ef6\u3002\u96a8\u8457\u696d\u52d9\u7684\u589e\u9577\uff0c\u6578\u64da\u5eab\u7684\u8ca0\u8f09\u4e5f\u6703\u96a8\u4e4b\u589e\u52a0\uff0c\u9019\u53ef\u80fd\u5c0e\u81f4\u6027\u80fd\u4e0b\u964d\u6216\u7cfb\u7d71\u6545\u969c\u3002\u5b9a\u671f\u76e3\u6e2c\u6578\u64da\u5eab\u670d\u52d9\u5668\u53ef\u4ee5\u5e6b\u52a9\u4f01\u696d\uff1a<\/p>\n<ul>\n<li>\u53ca\u6642\u767c\u73fe\u6027\u80fd\u74f6\u9838\uff0c\u907f\u514d\u7cfb\u7d71\u5d29\u6f70\u3002<\/li>\n<li>\u78ba\u4fdd\u6578\u64da\u7684\u5b8c\u6574\u6027\u548c\u5b89\u5168\u6027\u3002<\/li>\n<li>\u512a\u5316\u67e5\u8a62\u6027\u80fd\uff0c\u63d0\u5347\u7528\u6236\u9ad4\u9a57\u3002<\/li>\n<li>\u964d\u4f4e\u904b\u7dad\u6210\u672c\uff0c\u63d0\u5347\u8cc7\u6e90\u5229\u7528\u7387\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%b8%b8%e7%94%a8%e7%9a%84%e7%9b%a3%e6%b8%ac%e6%8c%87%e6%a8%99-AOfLLdrMZE\">\u5e38\u7528\u7684\u76e3\u6e2c\u6307\u6a19<\/h2>\n<p>\u5728\u76e3\u6e2c\u6578\u64da\u5eab\u670d\u52d9\u5668\u6642\uff0c\u6709\u5e7e\u500b\u95dc\u9375\u6307\u6a19\u9700\u8981\u95dc\u6ce8\uff1a<\/p>\n<h3 id=\"1-cpu-%e4%bd%bf%e7%94%a8%e7%8e%87-AOfLLdrMZE\">1. CPU \u4f7f\u7528\u7387<\/h3>\n<p>CPU \u4f7f\u7528\u7387\u662f\u8861\u91cf\u6578\u64da\u5eab\u670d\u52d9\u5668\u6027\u80fd\u7684\u91cd\u8981\u6307\u6a19\u3002\u904e\u9ad8\u7684 CPU \u4f7f\u7528\u7387\u53ef\u80fd\u8868\u660e\u67e5\u8a62\u6548\u7387\u4f4e\u4e0b\u6216\u8cc7\u6e90\u4e0d\u8db3\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b SQL \u67e5\u8a62\u4f86\u6aa2\u67e5 CPU \u4f7f\u7528\u7387\uff1a<\/p>\n<pre><code>SELECT * FROM sys.dm_os_performance_counters WHERE counter_name = 'Processor Time';<\/code><\/pre>\n<h3 id=\"2-%e8%a8%98%e6%86%b6%e9%ab%94%e4%bd%bf%e7%94%a8%e6%83%85%e6%b3%81-AOfLLdrMZE\">2. \u8a18\u61b6\u9ad4\u4f7f\u7528\u60c5\u6cc1<\/h3>\n<p>\u8a18\u61b6\u9ad4\u7684\u4f7f\u7528\u60c5\u6cc1\u76f4\u63a5\u5f71\u97ff\u6578\u64da\u5eab\u7684\u6027\u80fd\u3002\u76e3\u6e2c\u8a18\u61b6\u9ad4\u7684\u4f7f\u7528\u60c5\u6cc1\u53ef\u4ee5\u5e6b\u52a9\u7ba1\u7406\u54e1\u4e86\u89e3\u662f\u5426\u9700\u8981\u64f4\u5c55\u8cc7\u6e90\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u67e5\u8a62\u4f86\u6aa2\u67e5\u8a18\u61b6\u9ad4\u4f7f\u7528\u60c5\u6cc1\uff1a<\/p>\n<pre><code>SELECT total_physical_memory_kb, available_physical_memory_kb FROM sys.dm_os_sys_memory;<\/code><\/pre>\n<h3 id=\"3-%e7%a3%81%e7%a2%9f-i-o-%e6%80%a7%e8%83%bd-AOfLLdrMZE\">3. \u78c1\u789f I\/O \u6027\u80fd<\/h3>\n<p>\u78c1\u789f I\/O \u6027\u80fd\u5f71\u97ff\u6578\u64da\u7684\u8b80\u53d6\u548c\u5beb\u5165\u901f\u5ea6\u3002\u76e3\u6e2c\u78c1\u789f I\/O \u53ef\u4ee5\u5e6b\u52a9\u8b58\u5225\u6027\u80fd\u74f6\u9838\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u67e5\u8a62\u4f86\u6aa2\u67e5\u78c1\u789f I\/O \u6027\u80fd\uff1a<\/p>\n<pre><code>SELECT * FROM sys.dm_io_virtual_file_stats(NULL, NULL);<\/code><\/pre>\n<h3 id=\"4-%e6%9f%a5%e8%a9%a2%e6%80%a7%e8%83%bd-AOfLLdrMZE\">4. \u67e5\u8a62\u6027\u80fd<\/h3>\n<p>\u76e3\u6e2c\u67e5\u8a62\u6027\u80fd\u53ef\u4ee5\u5e6b\u52a9\u8b58\u5225\u6162\u67e5\u8a62\uff0c\u5f9e\u800c\u9032\u884c\u512a\u5316\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u67e5\u8a62\u4f86\u6aa2\u67e5\u6162\u67e5\u8a62\uff1a<\/p>\n<pre><code>SELECT * FROM sys.dm_exec_query_stats ORDER BY total_elapsed_time DESC;<\/code><\/pre>\n<h2 id=\"%e7%9b%a3%e6%b8%ac%e5%b7%a5%e5%85%b7-AOfLLdrMZE\">\u76e3\u6e2c\u5de5\u5177<\/h2>\n<p>\u9664\u4e86\u624b\u52d5\u67e5\u8a62\uff0c\u9084\u6709\u8a31\u591a\u5de5\u5177\u53ef\u4ee5\u5e6b\u52a9\u81ea\u52d5\u5316\u6578\u64da\u5eab\u76e3\u6e2c\u904e\u7a0b\uff1a<\/p>\n<ul>\n<li><strong>Prometheus<\/strong>\uff1a\u4e00\u500b\u958b\u6e90\u7684\u76e3\u6e2c\u7cfb\u7d71\uff0c\u652f\u6301\u591a\u7a2e\u6578\u64da\u5eab\u7684\u76e3\u6e2c\uff0c\u4e26\u63d0\u4f9b\u8c50\u5bcc\u7684\u53ef\u8996\u5316\u529f\u80fd\u3002<\/li>\n<li><strong>Grafana<\/strong>\uff1a\u8207 Prometheus \u7d50\u5408\u4f7f\u7528\uff0c\u53ef\u4ee5\u5275\u5efa\u7f8e\u89c0\u7684\u5100\u8868\u677f\uff0c\u5be6\u6642\u986f\u793a\u6578\u64da\u5eab\u6027\u80fd\u6307\u6a19\u3002<\/li>\n<li><strong>MySQL Enterprise Monitor<\/strong>\uff1a\u5c08\u70ba MySQL \u8a2d\u8a08\u7684\u76e3\u6e2c\u5de5\u5177\uff0c\u63d0\u4f9b\u5373\u6642\u6027\u80fd\u5206\u6790\u548c\u5831\u544a\u3002<\/li>\n<li><strong>pgAdmin<\/strong>\uff1a\u91dd\u5c0d PostgreSQL \u7684\u7ba1\u7406\u5de5\u5177\uff0c\u63d0\u4f9b\u76e3\u6e2c\u548c\u6027\u80fd\u5206\u6790\u529f\u80fd\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b5%90%e8%ab%96-AOfLLdrMZE\">\u7d50\u8ad6<\/h2>\n<p>\u6578\u64da\u5eab\u670d\u52d9\u5668\u7684\u76e3\u6e2c\u662f\u78ba\u4fdd\u7cfb\u7d71\u7a69\u5b9a\u6027\u548c\u6027\u80fd\u7684\u95dc\u9375\u3002\u901a\u904e\u95dc\u6ce8 CPU \u4f7f\u7528\u7387\u3001\u8a18\u61b6\u9ad4\u4f7f\u7528\u60c5\u6cc1\u3001\u78c1\u789f I\/O \u6027\u80fd\u548c\u67e5\u8a62\u6027\u80fd\u7b49\u6307\u6a19\uff0c\u4e26\u5229\u7528\u5404\u7a2e\u76e3\u6e2c\u5de5\u5177\uff0c\u7ba1\u7406\u54e1\u53ef\u4ee5\u53ca\u6642\u767c\u73fe\u554f\u984c\u4e26\u9032\u884c\u512a\u5316\u3002\u5c0d\u65bc\u9700\u8981\u9ad8\u6548\u80fd\u548c\u7a69\u5b9a\u6027\u7684\u696d\u52d9\u4f86\u8aaa\uff0c\u9078\u64c7\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u6216 <a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a> \u65b9\u6848\u4e5f\u662f\u81f3\u95dc\u91cd\u8981\u7684\u3002\u4e86\u89e3\u5982\u4f55\u6709\u6548\u76e3\u6e2c\u6578\u64da\u5eab\u670d\u52d9\u5668\uff0c\u5c07\u6709\u52a9\u65bc\u63d0\u5347\u6574\u9ad4\u696d\u52d9\u904b\u71df\u6548\u7387\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u6709\u6548\u76e3\u6e2c\u6578\u64da\u5eab\u670d\u52d9\u5668\uff0c\u78ba\u4fdd\u6027\u80fd\u7a69\u5b9a\uff0c\u53ca\u6642\u767c\u73fe\u554f\u984c\uff0c\u63d0\u5347\u6578\u64da\u7ba1\u7406\u6548\u7387\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-173537","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/173537","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=173537"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/173537\/revisions"}],"predecessor-version":[{"id":173538,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/173537\/revisions\/173538"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=173537"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=173537"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=173537"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}