{"id":2589,"date":"2013-03-21T17:59:14","date_gmt":"2013-03-21T09:59:14","guid":{"rendered":"https:\/\/kyle.ai\/blog\/?p=2589"},"modified":"2013-03-21T18:02:03","modified_gmt":"2013-03-21T10:02:03","slug":"%e5%9c%a8%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%e6%8e%92%e9%99%a4%e9%97%ae%e9%a2%98%e7%9a%84%e5%a4%b4%e4%ba%94%e5%88%86%e9%92%9f","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/2589.html","title":{"rendered":"\u5728\u670d\u52a1\u5668\u4e0a\u6392\u9664\u95ee\u9898\u7684\u5934\u4e94\u5206\u949f"},"content":{"rendered":"<p><span style=\"font-size: small;\">\u6211\u4eec\u56e2\u961f\u4e3a\u4e0a\u4e00\u5bb6\u516c\u53f8\u627f\u62c5\u8fd0\u7ef4\u3001\u4f18\u5316\u548c\u6269\u5c55\u5de5\u4f5c\u7684\u65f6\u5019\uff0c\u6211\u4eec\u78b0\u5230\u4e86\u5404\u79cd\u4e0d\u540c\u89c4\u6a21\u7684\u6027\u80fd\u5f88\u5dee\u7684\u7cfb\u7edf\u548c\u57fa\u7840\u8bbe\u5907\uff08\u5927\u578b\u7cfb\u7edf\u5c45\u591a\uff0c\u6bd4\u5982 CNN \u6216\u8005\u4e16\u754c\u94f6\u884c\u7684\u7cfb\u7edf\uff09\u3002\u8981\u662f\u518d\u8d76\u4e0a\u4fee\u590d\u65f6\u95f4\u7d27\u3001\u5947\u8469\u7684\u6280\u672f\u5e73\u53f0\u3001\u7f3a\u5c11\u4fe1\u606f\u548c\u6587\u6863\uff0c\u57fa\u672c\u4e0a\u8fd9\u8fc7\u7a0b\u90fd\u4f1a\u60e8\u75db\u5230\u8ba9\u6211\u4eec\u7559\u4e0b\u6df1\u523b\u7684\u8bb0\u5fc6\u3002<\/span><\/p>\n<p><span style=\"font-size: small;\">\u9047\u5230\u670d\u52a1\u5668\u6545\u969c\uff0c\u95ee\u9898\u51fa\u73b0\u7684\u539f\u56e0\u5f88\u5c11\u53ef\u4ee5\u4e00\u4e0b\u5c31\u60f3\u5230\u3002\u6211\u4eec\u57fa\u672c\u4e0a\u90fd\u4f1a\u4ece\u4ee5\u4e0b\u6b65\u9aa4\u5165\u624b\uff1a<\/span><\/p>\n<p><span style=\"font-size: small;\">\u4e00\u3001\u5c3d\u53ef\u80fd\u641e\u6e05\u695a\u95ee\u9898\u7684\u524d\u56e0\u540e\u679c<\/span><\/p>\n<p><span style=\"font-size: small;\">\u4e0d\u8981\u4e00\u4e0b\u5b50\u5c31\u624e\u5230\u670d\u52a1\u5668\u524d\u9762\uff0c\u4f60\u9700\u8981\u5148\u641e\u660e\u767d\u5bf9\u8fd9\u53f0\u670d\u52a1\u5668\u6709\u591a\u5c11\u5df2\u77e5\u7684\u60c5\u51b5\uff0c\u8fd8\u6709\u6545\u969c\u7684\u5177\u4f53\u60c5\u51b5\u3002\u4e0d\u7136\u4f60\u5f88\u53ef\u80fd\u5c31\u662f\u5728\u65e0\u7684\u653e\u77e2\u3002<\/span><\/p>\n<p><span style=\"font-size: small;\">\u5fc5\u987b\u641e\u6e05\u695a\u7684\u95ee\u9898\u6709\uff1a<\/span><\/p>\n<ul>\n<li><span style=\"font-size: small;\">\u6545\u969c\u7684\u8868\u73b0\u662f\u4ec0\u4e48\uff1f\u65e0\u54cd\u5e94\uff1f\u62a5\u9519\uff1f<\/span><\/li>\n<li><span style=\"font-size: small;\">\u6545\u969c\u662f\u4ec0\u4e48\u65f6\u5019\u53d1\u73b0\u7684\uff1f<\/span><\/li>\n<li><span style=\"font-size: small;\">\u6545\u969c\u662f\u5426\u53ef\u91cd\u73b0\uff1f<\/span><\/li>\n<li><span style=\"font-size: small;\">\u6709\u6ca1\u6709\u51fa\u73b0\u7684\u89c4\u5f8b\uff08\u6bd4\u5982\u6bcf\u5c0f\u65f6\u51fa\u73b0\u4e00\u6b21\uff09<\/span><\/li>\n<li><span style=\"font-size: small;\">\u6700\u540e\u4e00\u6b21\u5bf9\u6574\u4e2a\u5e73\u53f0\u8fdb\u884c\u66f4\u65b0\u7684\u5185\u5bb9\u662f\u4ec0\u4e48\uff08\u4ee3\u7801\u3001\u670d\u52a1\u5668\u7b49\uff09\uff1f<\/span><\/li>\n<li><span style=\"font-size: small;\">\u6545\u969c\u5f71\u54cd\u7684\u7279\u5b9a\u7528\u6237\u7fa4\u662f\u4ec0\u4e48\u6837\u7684(\u5df2\u767b\u5f55\u7684\uff0c \u9000\u51fa\u7684\uff0c \u67d0\u4e2a\u5730\u57df\u7684\u2026)?<\/span><\/li>\n<li><span style=\"font-size: small;\">\u57fa\u7840\u67b6\u6784\uff08\u7269\u7406\u7684\u3001\u903b\u8f91\u7684\uff09\u7684\u6587\u6863\u662f\u5426\u80fd\u627e\u5230?<\/span><\/li>\n<li><span style=\"font-size: small;\">\u662f\u5426\u6709\u76d1\u63a7\u5e73\u53f0\u53ef\u7528? \uff08\u6bd4\u5982 Munin\u3001Zabbix\u3001 Nagios\u3001 New Relic\u2026 \u4ec0\u4e48\u90fd\u53ef\u4ee5\uff09<\/span><\/li>\n<li><span style=\"font-size: small;\">\u662f\u5426\u6709\u65e5\u5fd7\u53ef\u4ee5\u67e5\u770b?. \uff08\u6bd4\u5982 Loggly\u3001Airbrake\u3001 Graylog\u2026\uff09<\/span><\/li>\n<\/ul>\n<p><span style=\"font-size: small;\">\u6700\u540e\u4e24\u4e2a\u662f\u6700\u65b9\u4fbf\u7684\u4fe1\u606f\u6765\u6e90\uff0c\u4e0d\u8fc7\u522b\u62b1\u592a\u5927\u5e0c\u671b\uff0c\u57fa\u672c\u4e0a\u5b83\u4eec\u90fd\u4e0d\u4f1a\u6709\u3002\u53ea\u80fd\u518d\u7ee7\u7eed\u6478\u7d22\u4e86\u3002<\/span><\/p>\n<p><span style=\"font-size: small;\">\u4e8c\u3001\u6709\u8c01\u5728?<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ w\r\n$ last\r\n<\/pre>\n<p><span style=\"font-size: small;\">\u7528\u8fd9\u4e24\u4e2a\u547d\u4ee4\u770b\u770b\u90fd\u6709\u8c01\u5728\u7ebf\uff0c\u6709\u54ea\u4e9b\u7528\u6237\u8bbf\u95ee\u8fc7\u3002\u8fd9\u4e0d\u662f\u4ec0\u4e48\u5173\u952e\u6b65\u9aa4\uff0c\u4e0d\u8fc7\u6700\u597d\u522b\u5728\u5176\u4ed6\u7528\u6237\u6b63\u5e72\u6d3b\u7684\u65f6\u5019\u6765\u8c03\u8bd5\u7cfb\u7edf\u3002\u6709\u9053\u662f\u4e00\u5c71\u4e0d\u5bb9\u4e8c\u864e\u561b\u3002\uff08ne cook in the kitchen is enough.\uff09<\/span><\/p>\n<p><span style=\"font-size: small;\">\u4e09\u3001\u4e4b\u524d\u53d1\u751f\u4e86\u4ec0\u4e48?<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ history\r\n<\/pre>\n<p><span style=\"font-size: small;\">\u67e5\u770b\u4e00\u4e0b\u4e4b\u524d\u670d\u52a1\u5668\u4e0a\u6267\u884c\u8fc7\u7684\u547d\u4ee4\u3002\u770b\u4e00\u4e0b\u603b\u662f\u6ca1\u9519\u7684\uff0c\u52a0\u4e0a\u524d\u9762\u770b\u7684\u8c01\u767b\u5f55\u8fc7\u7684\u4fe1\u606f\uff0c\u5e94\u8be5\u6709\u70b9\u7528\u3002\u53e6\u5916\u4f5c\u4e3a admin \u8981\u6ce8\u610f\uff0c\u4e0d\u8981\u5229\u7528\u81ea\u5df1\u7684\u6743\u9650\u53bb\u4fb5\u72af\u522b\u4eba\u7684\u9690\u79c1\u54e6\u3002<\/span><\/p>\n<p><span style=\"font-size: small;\">\u5230\u8fd9\u91cc\u5148\u63d0\u9192\u4e00\u4e0b\uff0c\u7b49\u4f1a\u4f60\u53ef\u80fd\u4f1a\u9700\u8981\u66f4\u65b0 HISTTIMEFORMAT \u73af\u5883\u53d8\u91cf\u6765\u663e\u793a\u8fd9\u4e9b\u547d\u4ee4\u88ab\u6267\u884c\u7684\u65f6\u95f4\u3002\u5bf9\u8981\u4e0d\u7136\u5149\u770b\u5230\u4e00\u5806\u4e0d\u77e5\u9053\u5565\u65f6\u5019\u6267\u884c\u7684\u547d\u4ee4\uff0c\u540c\u6837\u4f1a\u4ee4\u4eba\u6293\u72c2\u7684\u3002<\/span><\/p>\n<p><span style=\"font-size: small;\">\u56db\u3001\u73b0\u5728\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u662f\u5565?<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ pstree -a\r\n$ ps aux\r\n<\/pre>\n<p><span style=\"font-size: small;\">\u8fd9\u90fd\u662f\u67e5\u770b\u73b0\u6709\u8fdb\u7a0b\u7684\u3002 ps aux \u7684\u7ed3\u679c\u6bd4\u8f83\u6742\u4e71\uff0c pstree -a \u7684\u7ed3\u679c\u6bd4\u8f83\u7b80\u5355\u660e\u4e86\uff0c\u53ef\u4ee5\u770b\u5230\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u53ca\u76f8\u5173\u7528\u6237\u3002<\/span><\/p>\n<p><span style=\"font-size: small;\">\u4e94\u3001\u76d1\u542c\u7684\u7f51\u7edc\u670d\u52a1<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ netstat -ntlp\r\n$ netstat -nulp\r\n$ netstat -nxlp\r\n<\/pre>\n<p><span style=\"font-size: small;\">\u6211\u4e00\u822c\u90fd\u5206\u5f00\u8fd0\u884c\u8fd9\u4e09\u4e2a\u547d\u4ee4\uff0c\u4e0d\u60f3\u4e00\u4e0b\u5b50\u770b\u5230\u5217\u51fa\u4e00\u5927\u5806\u6240\u6709\u7684\u670d\u52a1\u3002netstat -nalp \u5012\u4e5f\u53ef\u4ee5\u3002\u4e0d\u8fc7\u6211\u7edd\u4e0d\u4f1a\u7528 numeric \u9009\u9879 \uff08\u9119\u4eba\u4e00\u70b9\u6d45\u8584\u7684\u770b\u6cd5\uff1aIP \u5730\u5740\u770b\u8d77\u6765\u66f4\u65b9\u4fbf\uff09\u3002<\/span><\/p>\n<p><span style=\"font-size: small;\">\u627e\u5230\u6240\u6709\u6b63\u5728\u8fd0\u884c\u7684\u670d\u52a1\uff0c\u68c0\u67e5\u5b83\u4eec\u662f\u5426\u5e94\u8be5\u8fd0\u884c\u3002\u67e5\u770b\u5404\u4e2a\u76d1\u542c\u7aef\u53e3\u3002\u5728 netstat \u663e\u793a\u7684\u670d\u52a1\u5217\u8868\u4e2d\u7684 PID \u548c ps aux \u8fdb\u7a0b\u5217\u8868\u4e2d\u7684\u662f\u4e00\u6837\u7684\u3002<\/span><\/p>\n<p><span style=\"font-size: small;\">\u5982\u679c\u670d\u52a1\u5668\u4e0a\u6709\u597d\u51e0\u4e2a Java \u6216\u8005 Erlang \u4ec0\u4e48\u7684\u8fdb\u7a0b\u5728\u540c\u65f6\u8fd0\u884c\uff0c\u80fd\u591f\u6309 PID \u5206\u522b\u627e\u5230\u6bcf\u4e2a\u8fdb\u7a0b\u5c31\u5f88\u91cd\u8981\u4e86\u3002<\/span><\/p>\n<p><span style=\"font-size: small;\">\u901a\u5e38\u6211\u4eec\u5efa\u8bae\u6bcf\u53f0\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\u7684\u670d\u52a1\u5c11\u4e00\u70b9\uff0c\u5fc5\u8981\u65f6\u53ef\u4ee5\u589e\u52a0\u670d\u52a1\u5668\u3002\u5982\u679c\u4f60\u770b\u5230\u4e00\u53f0\u670d\u52a1\u5668\u4e0a\u6709\u4e09\u56db\u5341\u4e2a\u76d1\u542c\u7aef\u53e3\u5f00\u7740\uff0c\u90a3\u8fd8\u662f\u505a\u4e2a\u8bb0\u5f55\uff0c\u56de\u5934\u6709\u7a7a\u7684\u65f6\u5019\u6e05\u7406\u4e00\u4e0b\uff0c\u91cd\u65b0\u7ec4\u7ec7\u4e00\u4e0b\u670d\u52a1\u5668\u3002<\/span><\/p>\n<p><span style=\"font-size: small;\">\u516d\u3001CPU \u548c\u5185\u5b58<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ free -m\r\n$ uptime\r\n$ top\r\n$ htop\r\n<\/pre>\n<p><span style=\"font-size: small;\">\u6ce8\u610f\u4ee5\u4e0b\u95ee\u9898:<\/span><\/p>\n<ul>\n<li><span style=\"font-size: small;\">\u8fd8\u6709\u7a7a\u4f59\u7684\u5185\u5b58\u5417? \u670d\u52a1\u5668\u662f\u5426\u6b63\u5728\u5185\u5b58\u548c\u786c\u76d8\u4e4b\u95f4\u8fdb\u884c swap?<\/span><\/li>\n<li><span style=\"font-size: small;\">\u8fd8\u6709\u5269\u4f59\u7684 CPU \u5417? \u670d\u52a1\u5668\u662f\u51e0\u6838\u7684? \u662f\u5426\u6709\u67d0\u4e9b CPU \u6838\u8d1f\u8f7d\u8fc7\u591a\u4e86?<\/span><\/li>\n<li><span style=\"font-size: small;\">\u670d\u52a1\u5668\u6700\u5927\u7684\u8d1f\u8f7d\u6765\u81ea\u4ec0\u4e48\u5730\u65b9? \u5e73\u5747\u8d1f\u8f7d\u662f\u591a\u5c11?<\/span><\/li>\n<\/ul>\n<p><span style=\"font-size: small;\">\u4e03\u3001\u786c\u4ef6<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ lspci\r\n$ dmidecode\r\n$ ethtool\r\n<\/pre>\n<p><span style=\"font-size: small;\">\u6709\u5f88\u591a\u670d\u52a1\u5668\u8fd8\u662f\u88f8\u673a\u72b6\u6001\uff0c\u53ef\u4ee5\u770b\u4e00\u4e0b\uff1a<\/span><\/p>\n<ul>\n<li><span style=\"font-size: small;\">\u627e\u5230 RAID \u5361 (\u662f\u5426\u5e26 BBU \u5907\u7528\u7535\u6c60?)\u3001 CPU\u3001\u7a7a\u4f59\u7684\u5185\u5b58\u63d2\u69fd\u3002\u6839\u636e\u8fd9\u4e9b\u60c5\u51b5\u53ef\u4ee5\u5927\u81f4\u4e86\u89e3\u786c\u4ef6\u95ee\u9898\u7684\u6765\u6e90\u548c\u6027\u80fd\u6539\u8fdb\u7684\u529e\u6cd5\u3002<\/span><\/li>\n<li><span style=\"font-size: small;\">\u7f51\u5361\u662f\u5426\u8bbe\u7f6e\u597d? \u662f\u5426\u6b63\u8fd0\u884c\u5728\u534a\u53cc\u5de5\u72b6\u6001? \u901f\u5ea6\u662f 10MBps? \u6709\u6ca1\u6709 TX\/RX \u62a5\u9519?<\/span><\/li>\n<\/ul>\n<p><span style=\"font-size: small;\">\u516b\u3001IO \u6027\u80fd<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ iostat -kx 2\r\n$ vmstat 2 10\r\n$ mpstat 2 10\r\n$ dstat --top-io --top-bio\r\n<\/pre>\n<p><span style=\"font-size: small;\">\u8fd9\u4e9b\u547d\u4ee4\u5bf9\u4e8e\u8c03\u8bd5\u540e\u7aef\u6027\u80fd\u975e\u5e38\u6709\u7528\u3002<\/span><\/p>\n<ul>\n<li><span style=\"font-size: small;\">\u68c0\u67e5\u78c1\u76d8\u4f7f\u7528\u91cf\uff1a\u670d\u52a1\u5668\u786c\u76d8\u662f\u5426\u5df2\u6ee1?<\/span><\/li>\n<li><span style=\"font-size: small;\">\u662f\u5426\u5f00\u542f\u4e86 swap \u4ea4\u6362\u6a21\u5f0f (si\/so)?<\/span><\/li>\n<li><span style=\"font-size: small;\">CPU \u88ab\u8c01\u5360\u7528\uff1a\u7cfb\u7edf\u8fdb\u7a0b? \u7528\u6237\u8fdb\u7a0b? \u865a\u62df\u673a?<\/span><\/li>\n<li><span style=\"font-size: small;\">dstat \u662f\u6211\u7684\u6700\u7231\u3002\u7528\u5b83\u53ef\u4ee5\u770b\u5230\u8c01\u5728\u8fdb\u884c IO\uff1a \u662f\u4e0d\u662f MySQL \u5403\u6389\u4e86\u6240\u6709\u7684\u7cfb\u7edf\u8d44\u6e90? \u8fd8\u662f\u4f60\u7684 PHP \u8fdb\u7a0b?<\/span><\/li>\n<\/ul>\n<p><span style=\"font-size: small;\">\u4e5d\u3001\u6302\u8f7d\u70b9\u548c\u6587\u4ef6\u7cfb\u7edf<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ mount\r\n$ cat \/etc\/fstab\r\n$ vgs\r\n$ pvs\r\n$ lvs\r\n$ df -h\r\n$ lsof +D \/ \/* beware not to kill your box *\/\r\n<\/pre>\n<ul>\n<li><span style=\"font-size: small;\">\u4e00\u5171\u6302\u8f7d\u4e86\u591a\u5c11\u6587\u4ef6\u7cfb\u7edf?<\/span><\/li>\n<li><span style=\"font-size: small;\">\u6709\u6ca1\u6709\u67d0\u4e2a\u670d\u52a1\u4e13\u7528\u7684\u6587\u4ef6\u7cfb\u7edf? (\u6bd4\u5982 MySQL?)<\/span><\/li>\n<li><span style=\"font-size: small;\">\u6587\u4ef6\u7cfb\u7edf\u7684\u6302\u8f7d\u9009\u9879\u662f\u4ec0\u4e48\uff1a noatime? default? \u6709\u6ca1\u6709\u6587\u4ef6\u7cfb\u7edf\u88ab\u91cd\u65b0\u6302\u8f7d\u4e3a\u53ea\u8bfb\u6a21\u5f0f\u4e86\uff1f<\/span><\/li>\n<li><span style=\"font-size: small;\">\u78c1\u76d8\u7a7a\u95f4\u662f\u5426\u8fd8\u6709\u5269\u4f59?<\/span><\/li>\n<li><span style=\"font-size: small;\">\u662f\u5426\u6709\u5927\u6587\u4ef6\u88ab\u5220\u9664\u4f46\u6ca1\u6709\u6e05\u7a7a?<\/span><\/li>\n<li><span style=\"font-size: small;\">\u5982\u679c\u78c1\u76d8\u7a7a\u95f4\u6709\u95ee\u9898\uff0c\u4f60\u662f\u5426\u8fd8\u6709\u7a7a\u95f4\u6765\u6269\u5c55\u4e00\u4e2a\u5206\u533a\uff1f<\/span><\/li>\n<\/ul>\n<p><span style=\"font-size: small;\">\u5341\u3001\u5185\u6838\u3001\u4e2d\u65ad\u548c\u7f51\u7edc<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ sysctl -a | grep ...\r\n$ cat \/proc\/interrupts\r\n$ cat \/proc\/net\/ip_conntrack \/* may take some time on busy servers *\/\r\n$ netstat\r\n$ ss -s\r\n<\/pre>\n<ul>\n<li><span style=\"font-size: small;\">\u4f60\u7684\u4e2d\u65ad\u8bf7\u6c42\u662f\u5426\u662f\u5747\u8861\u5730\u5206\u914d\u7ed9 CPU \u5904\u7406\uff0c\u8fd8\u662f\u4f1a\u6709\u67d0\u4e2a CPU \u7684\u6838\u56e0\u4e3a\u5927\u91cf\u7684\u7f51\u7edc\u4e2d\u65ad\u8bf7\u6c42\u6216\u8005 RAID \u8bf7\u6c42\u800c\u8fc7\u8f7d\u4e86\uff1f<\/span><\/li>\n<li><span style=\"font-size: small;\">SWAP \u4ea4\u6362\u7684\u8bbe\u7f6e\u662f\u4ec0\u4e48\uff1f\u5bf9\u4e8e\u5de5\u4f5c\u7ad9\u6765\u8bf4 swappinness \u8bbe\u4e3a 60 \u5c31\u5f88\u597d\uff0c \u4e0d\u8fc7\u5bf9\u4e8e\u670d\u52a1\u5668\u5c31\u592a\u7cdf\u4e86\uff1a\u4f60\u6700\u597d\u6c38\u8fdc\u4e0d\u8981\u8ba9\u670d\u52a1\u5668\u505a SWAP \u4ea4\u6362\uff0c\u4e0d\u7136\u5bf9\u78c1\u76d8\u7684\u8bfb\u5199\u4f1a\u9501\u6b7b SWAP \u8fdb\u7a0b\u3002<\/span><\/li>\n<li><span style=\"font-size: small;\">conntrack_max \u662f\u5426\u8bbe\u7684\u8db3\u591f\u5927\uff0c\u80fd\u5e94\u4ed8\u4f60\u670d\u52a1\u5668\u7684\u6d41\u91cf?<\/span><\/li>\n<li><span style=\"font-size: small;\">\u5728\u4e0d\u540c\u72b6\u6001\u4e0b(TIME_WAIT, \u2026) TCP \u8fde\u63a5\u65f6\u95f4\u7684\u8bbe\u7f6e\u662f\u600e\u6837\u7684\uff1f<\/span><\/li>\n<li><span style=\"font-size: small;\">\u5982\u679c\u8981\u663e\u793a\u6240\u6709\u5b58\u5728\u7684\u8fde\u63a5\uff0cnetstat \u4f1a\u6bd4\u8f83\u6162\uff0c \u4f60\u53ef\u4ee5\u5148\u7528 ss \u770b\u4e00\u4e0b\u603b\u4f53\u60c5\u51b5\u3002<\/span><\/li>\n<li><span style=\"font-size: small;\">\u4f60\u8fd8\u53ef\u4ee5\u770b\u4e00\u4e0b Linux TCP tuning \u4e86\u89e3\u7f51\u7edc\u6027\u80fd\u8c03\u4f18\u7684\u4e00\u4e9b\u8981\u70b9\u3002<\/span><\/li>\n<\/ul>\n<p><span style=\"font-size: small;\">\u5341\u4e00\u3001\u7cfb\u7edf\u65e5\u5fd7\u548c\u5185\u6838\u6d88\u606f<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ dmesg\r\n$ less \/var\/log\/messages\r\n$ less \/var\/log\/secure\r\n$ less \/var\/log\/auth\r\n<\/pre>\n<ul>\n<li><span style=\"font-size: small;\">\u67e5\u770b\u9519\u8bef\u548c\u8b66\u544a\u6d88\u606f\uff0c\u6bd4\u5982\u770b\u770b\u662f\u4e0d\u662f\u5f88\u591a\u5173\u4e8e\u8fde\u63a5\u6570\u8fc7\u591a\u5bfc\u81f4\uff1f<\/span><\/li>\n<li><span style=\"font-size: small;\">\u770b\u770b\u662f\u5426\u6709\u786c\u4ef6\u9519\u8bef\u6216\u6587\u4ef6\u7cfb\u7edf\u9519\u8bef?<\/span><\/li>\n<li><span style=\"font-size: small;\">\u5206\u6790\u662f\u5426\u80fd\u5c06\u8fd9\u4e9b\u9519\u8bef\u4e8b\u4ef6\u548c\u524d\u9762\u53d1\u73b0\u7684\u7591\u70b9\u8fdb\u884c\u65f6\u95f4\u4e0a\u7684\u6bd4\u5bf9\u3002<\/span><\/li>\n<\/ul>\n<p><span style=\"font-size: small;\">\u5341\u4e8c\u3001\u5b9a\u65f6\u4efb\u52a1<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ ls \/etc\/cron* + cat\r\n$ for user in $(cat \/etc\/passwd | cut -f1 -d:); do crontab -l -u $user; done\r\n<\/pre>\n<ul>\n<li><span style=\"font-size: small;\">\u662f\u5426\u6709\u67d0\u4e2a\u5b9a\u65f6\u4efb\u52a1\u8fd0\u884c\u8fc7\u4e8e\u9891\u7e41?<\/span><\/li>\n<li><span style=\"font-size: small;\">\u662f\u5426\u6709\u4e9b\u7528\u6237\u63d0\u4ea4\u4e86\u9690\u85cf\u7684\u5b9a\u65f6\u4efb\u52a1?<\/span><\/li>\n<li><span style=\"font-size: small;\">\u5728\u51fa\u73b0\u6545\u969c\u7684\u65f6\u5019\uff0c\u662f\u5426\u6b63\u597d\u6709\u67d0\u4e2a\u5907\u4efd\u4efb\u52a1\u5728\u6267\u884c\uff1f<\/span><\/li>\n<\/ul>\n<p><span style=\"font-size: small;\">\u5341\u4e09\u3001\u5e94\u7528\u7cfb\u7edf\u65e5\u5fd7<\/span><\/p>\n<p><span style=\"font-size: small;\">\u8fd9\u91cc\u8fb9\u53ef\u5206\u6790\u7684\u4e1c\u897f\u5c31\u591a\u4e86\uff0c \u4e0d\u8fc7\u6050\u6015\u4f60\u4f5c\u4e3a\u8fd0\u7ef4\u4eba\u5458\u662f\u6ca1\u529f\u592b\u53bb\u4ed4\u7ec6\u7814\u7a76\u5b83\u7684\u3002\u5173\u6ce8\u90a3\u4e9b\u660e\u663e\u7684\u95ee\u9898\uff0c\u6bd4\u5982\u5728\u4e00\u4e2a\u5178\u578b\u7684 LAMP\uff08Linux+Apache+Mysql+Perl\uff09\u5e94\u7528\u73af\u5883\u91cc:<\/span><\/p>\n<ul>\n<li><span style=\"font-size: small;\">Apache &amp; Nginx; \u67e5\u627e\u8bbf\u95ee\u548c\u9519\u8bef\u65e5\u5fd7\uff0c \u76f4\u63a5\u627e 5xx \u9519\u8bef\uff0c \u518d\u770b\u770b\u662f\u5426\u6709 limit_zone \u9519\u8bef\u3002<\/span><\/li>\n<li><span style=\"font-size: small;\">MySQL; \u5728mysql.log \u627e\u9519\u8bef\u6d88\u606f\uff0c\u770b\u770b\u6709\u6ca1\u6709\u7ed3\u6784\u635f\u574f\u7684\u8868\uff0c \u662f\u5426\u6709 innodb \u4fee\u590d\u8fdb\u7a0b\u5728\u8fd0\u884c\uff0c\u662f\u5426\u6709 disk\/index\/query \u95ee\u9898.<\/span><\/li>\n<li><span style=\"font-size: small;\">PHP-FPM; \u5982\u679c\u8bbe\u5b9a\u4e86 php-slow \u65e5\u5fd7\uff0c \u76f4\u63a5\u627e\u9519\u8bef\u4fe1\u606f (php, mysql, memcache, \u2026)\uff0c\u5982\u679c\u6ca1\u8bbe\u5b9a\uff0c\u8d76\u7d27\u8bbe\u5b9a\u3002<\/span><\/li>\n<li><span style=\"font-size: small;\">Varnish; \u5728varnishlog \u548c varnishstat \u91cc, \u68c0\u67e5 hit\/miss \u6bd4. \u770b\u770b\u914d\u7f6e\u4fe1\u606f\u91cc\u662f\u5426\u9057\u6f0f\u4e86\u4ec0\u4e48\u89c4\u5219\uff0c\u4f7f\u6700\u7ec8\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u653b\u51fb\u4f60\u7684\u540e\u7aef\uff1f<\/span><\/li>\n<li><span style=\"font-size: small;\">HA-Proxy; \u540e\u7aef\u7684\u72b6\u51b5\u5982\u4f55\uff1f\u5065\u5eb7\u72b6\u51b5\u68c0\u67e5\u662f\u5426\u6210\u529f\uff1f\u662f\u524d\u7aef\u8fd8\u662f\u540e\u7aef\u7684\u961f\u5217\u5927\u5c0f\u8fbe\u5230\u6700\u5927\u503c\u4e86\uff1f<\/span><\/li>\n<\/ul>\n<p><span style=\"font-size: small;\">\u7ed3\u8bba<\/span><\/p>\n<p><span style=\"font-size: small;\">\u7ecf\u8fc7\u8fd9 5 \u5206\u949f\u4e4b\u540e\uff0c\u4f60\u5e94\u8be5\u5bf9\u5982\u4e0b\u60c5\u51b5\u6bd4\u8f83\u6e05\u695a\u4e86\uff1a<\/span><\/p>\n<ul>\n<li><span style=\"font-size: small;\">\u5728\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\u7684\u90fd\u662f\u4e9b\u5565\uff1f<\/span><\/li>\n<li><span style=\"font-size: small;\">\u8fd9\u4e2a\u6545\u969c\u770b\u8d77\u6765\u662f\u548c IO\/\u786c\u4ef6\/\u7f51\u7edc\u6216\u8005\u7cfb\u7edf\u914d\u7f6e (\u6709\u95ee\u9898\u7684\u4ee3\u7801\u3001\u7cfb\u7edf\u5185\u6838\u8c03\u4f18\uff0c \u2026)\u76f8\u5173\u3002<\/span><\/li>\n<li><span style=\"font-size: small;\">\u8fd9\u4e2a\u6545\u969c\u662f\u5426\u6709\u4f60\u719f\u6089\u7684\u4e00\u4e9b\u7279\u5f81\uff1f\u6bd4\u5982\u5bf9\u6570\u636e\u5e93\u7d22\u5f15\u4f7f\u7528\u4e0d\u5f53\uff0c\u6216\u8005\u592a\u591a\u7684 apache \u540e\u53f0\u8fdb\u7a0b\u3002<\/span><\/li>\n<li><span style=\"font-size: small;\">\u4f60\u751a\u81f3\u6709\u53ef\u80fd\u627e\u5230\u771f\u6b63\u7684\u6545\u969c\u6e90\u5934\u3002\u5c31\u7b97\u8fd8\u6ca1\u6709\u627e\u5230\uff0c\u641e\u6e05\u695a\u4e86\u4e0a\u9762\u8fd9\u4e9b\u60c5\u51b5\u4e4b\u540e\uff0c\u4f60\u73b0\u5728\u4e5f\u5177\u5907\u4e86\u6df1\u6316\u4e0b\u53bb\u7684\u6761\u4ef6\u3002\u7ee7\u7eed\u52aa\u529b\u5427\uff01<\/span><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u4eec\u56e2\u961f\u4e3a\u4e0a\u4e00\u5bb6\u516c\u53f8\u627f\u62c5\u8fd0\u7ef4\u3001\u4f18\u5316\u548c\u6269\u5c55\u5de5\u4f5c\u7684\u65f6\u5019\uff0c\u6211\u4eec\u78b0\u5230\u4e86\u5404\u79cd\u4e0d\u540c\u89c4\u6a21\u7684\u6027\u80fd\u5f88\u5dee\u7684\u7cfb\u7edf\u548c\u57fa\u7840\u8bbe\u5907\uff08\u5927\u578b\u7cfb\u7edf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-2589","post","type-post","status-publish","format-standard","hentry","category-skill"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/2589","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=2589"}],"version-history":[{"count":3,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/2589\/revisions"}],"predecessor-version":[{"id":2591,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/2589\/revisions\/2591"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=2589"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=2589"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=2589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}