{"id":71088,"date":"2026-02-03T06:41:07","date_gmt":"2026-02-02T22:41:07","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/71088.html"},"modified":"2026-02-03T06:41:07","modified_gmt":"2026-02-02T22:41:07","slug":"linux-%e9%92%88%e5%af%b9-mysql-%e4%b8%93%e7%94%a8%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%9a%84-oom-%e9%a2%84%e9%98%b2%e7%ad%96%e7%95%a5%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/71088.html","title":{"rendered":"Linux \u9488\u5bf9 MySQL \u4e13\u7528\u670d\u52a1\u5668\u7684 OOM \u9884\u9632\u7b56\u7565\u914d\u7f6e"},"content":{"rendered":"<p>\u5bf9\u4e8e\u53ea\u8fd0\u884c MySQL \u7684\u670d\u52a1\u5668&#xff0c;\u5982\u679c\u89e6\u53d1 OOM&#xff0c;\u65e0\u8bba\u600e\u6837\u8bbe\u7f6e&#xff0c;\u6570\u636e\u5e93\u8fdb\u7a0b\u88ab\u6740\u6b7b\u51e0\u4e4e\u662f\u5fc5\u7136\u7684\u3002\u8fd9\u662f\u56e0\u4e3a&#xff1a;<\/p>\n<h3>\u4e3a\u4ec0\u4e48 MySQL \u603b\u662f\u9996\u5f53\u5176\u51b2&#xff1f;<\/h3>\n<li>\n<p>\u5185\u5b58\u5360\u7528\u6700\u5927<br \/>\n\u5728\u4e13\u7528 MySQL \u670d\u52a1\u5668\u4e0a&#xff0c;MySQL \u901a\u5e38\u5360\u7528 80-99% \u7684\u7269\u7406\u5185\u5b58&#xff08;\u5305\u62ec InnoDB Buffer Pool\u3001Key Buffer \u7b49&#xff09;&#xff0c;\u5176\u4ed6\u8fdb\u7a0b&#xff08;SSH\u3001\u76d1\u63a7\u7b49&#xff09;\u5185\u5b58\u4f7f\u7528\u5fae\u4e0d\u8db3\u9053\u3002<\/p>\n<\/li>\n<li>\n<p>OOM Killer \u7684\u8ba1\u7b97\u903b\u8f91<br \/>\nOOM Killer \u57fa\u4e8e oom_score \u9009\u62e9\u76ee\u6807&#xff0c;\u4e3b\u8981\u8003\u8651\u56e0\u7d20\u5305\u62ec&#xff1a;<\/p>\n<ul>\n<li>\u5185\u5b58\u4f7f\u7528\u91cf&#xff08;RSS&#xff09;&#xff1a;MySQL \u901a\u5e38\u6700\u9ad8<\/li>\n<li>\u8fdb\u7a0b\u8fd0\u884c\u65f6\u95f4&#xff1a;\u867d\u7136\u957f\u65f6\u95f4\u8fd0\u884c\u7684\u8fdb\u7a0b\u6709\u4fdd\u62a4&#xff0c;\u4f46\u62b5\u4e0d\u8fc7\u5185\u5b58\u4f7f\u7528\u91cf\u7684\u6743\u91cd<\/li>\n<li>\u7279\u6743\u7ea7&#xff1a;\u5373\u4f7f MySQL \u4ee5 root \u8fd0\u884c&#xff0c;\u4fdd\u62a4\u4f5c\u7528\u6709\u9650<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u8fc7\u5ea6\u5206\u914d\u5bfc\u81f4\u7684&#034;\u5b8c\u7f8e\u98ce\u66b4&#034;<br \/>\nMySQL \u53ef\u80fd\u540c\u65f6\u9762\u4e34&#xff1a;<\/p>\n<ul>\n<li>\u81ea\u8eab Buffer Pool \u5360\u7528\u5927\u91cf\u5185\u5b58<\/li>\n<li>\u5927\u91cf\u8fde\u63a5\u548c\u4e34\u65f6\u8868<\/li>\n<li>\u64cd\u4f5c\u7cfb\u7edf\u6587\u4ef6\u7f13\u5b58\u4e5f\u5360\u7528\u5185\u5b58<\/li>\n<li>Swap \u7a7a\u95f4\u4e0d\u8db3\u6216\u8bbf\u95ee\u8fc7\u6162<\/li>\n<\/ul>\n<\/li>\n<h3>\u5373\u4f7f\u8bbe\u7f6e\u4e86\u4fdd\u62a4\u4e5f\u53ef\u80fd\u5931\u6548<\/h3>\n<p><span class=\"token comment\"># \u5e38\u89c1\u7684\u4fdd\u62a4\u8bbe\u7f6e<\/span><br \/>\n<span class=\"token builtin class-name\">echo<\/span> -1000 <span class=\"token operator\">&gt;<\/span> \/proc\/<span class=\"token variable\"><span class=\"token variable\">$(<\/span>pgrep mysqld<span class=\"token variable\">)<\/span><\/span>\/oom_score_adj<\/p>\n<p>\u8fd9\u79cd\u65b9\u6cd5\u5728\u6df7\u5408\u8d1f\u8f7d\u670d\u52a1\u5668\u4e0a\u6709\u6548&#xff0c;\u4f46\u5728\u4e13\u7528 MySQL \u670d\u52a1\u5668\u4e0a&#xff1a;<\/p>\n<ul>\n<li>\u5f53\u7cfb\u7edf\u5185\u5b58\u8017\u5c3d\u65f6&#xff0c;\u5fc5\u987b\u6740\u6b7b\u67d0\u4e2a\u8fdb\u7a0b<\/li>\n<li>\u5176\u4ed6\u8fdb\u7a0b\u592a\u5c0f&#xff0c;\u6740\u6b7b\u5b83\u4eec\u91ca\u653e\u7684\u5185\u5b58\u676f\u6c34\u8f66\u85aa<\/li>\n<li>\u5185\u6838\u4f1a&#034;\u806a\u660e\u5730&#034;\u5ffd\u7565 oom_score_adj&#xff0c;\u9009\u62e9\u80fd\u91ca\u653e\u5927\u91cf\u5185\u5b58\u7684\u8fdb\u7a0b<\/li>\n<li>MySQL \u6210\u4e3a\u552f\u4e00\u6709\u6548\u76ee\u6807<\/li>\n<\/ul>\n<h3>\u9488\u5bf9\u4e13\u7528 MySQL \u670d\u52a1\u5668\u7684 OOM \u9884\u9632\u7b56\u7565<\/h3>\n<h4>1. \u7981\u7528 Overcommit&#xff08;\u6700\u5173\u952e\u7684\u8bbe\u7f6e&#xff09;<\/h4>\n<p><span class=\"token comment\"># \/etc\/sysctl.conf \u6216 \/etc\/sysctl.d\/99-mysql.conf<\/span><br \/>\nvm.overcommit_memory <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">2<\/span><br \/>\nvm.overcommit_ratio <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">95<\/span><\/p>\n<p>\u8ba1\u7b97 CommitLimit &#061; \u7269\u7406\u5185\u5b58 \u00d7 overcommit_ratio\/100 &#043; Swap<\/p>\n<ul>\n<li>\u5f53\u7533\u8bf7\u5185\u5b58\u8d85\u8fc7\u6b64\u9650\u5236\u65f6&#xff0c;malloc() \u76f4\u63a5\u8fd4\u56de\u5931\u8d25<\/li>\n<li>MySQL \u4f1a\u6536\u5230 ENOMEM \u9519\u8bef&#xff0c;\u800c\u4e0d\u662f\u7a81\u7136\u88ab\u6740\u6b7b<\/li>\n<\/ul>\n<p>\u91cd\u8981&#xff1a;\u9700\u8981\u914d\u7f6e MySQL \u6b63\u786e\u5904\u7406\u5185\u5b58\u5206\u914d\u5931\u8d25\u3002<\/p>\n<h4>2. \u5408\u7406\u914d\u7f6e MySQL \u5185\u5b58\u4f7f\u7528<\/h4>\n<p># my.cnf \u5173\u952e\u914d\u7f6e<br \/>\n[mysqld]<br \/>\n# InnoDB Buffer Pool &#8211; \u4e0d\u8981\u8d85\u8fc7\u7269\u7406\u5185\u5b58\u7684 70-80%<br \/>\ninnodb_buffer_pool_size &#061; \u7269\u7406\u5185\u5b58\u7684 70%<\/p>\n<p># \u9650\u5236\u5168\u5c40\u548c\u6bcf\u4e2a\u8fde\u63a5\u7684\u5185\u5b58\u4f7f\u7528<br \/>\nmax_connections &#061; \u5408\u7406\u503c&#xff08;\u5982 200&#xff09;<br \/>\n# \u6bcf\u4e2a\u8fde\u63a5\u7684\u5185\u5b58\u9650\u5236<br \/>\ntmp_table_size &#061; 32M<br \/>\nmax_heap_table_size &#061; 32M<br \/>\njoin_buffer_size &#061; \u5408\u7406\u503c<br \/>\nsort_buffer_size &#061; \u5408\u7406\u503c<br \/>\nread_buffer_size &#061; \u5408\u7406\u503c<br \/>\nread_rnd_buffer_size &#061; \u5408\u7406\u503c<\/p>\n<p># \u76d1\u63a7\u548c\u9650\u5236<br \/>\nperformance_schema &#061; ON<\/p>\n<h4>3. \u914d\u7f6e Swap \u4f46\u907f\u514d\u8fc7\u5ea6\u4f7f\u7528<\/h4>\n<p><span class=\"token comment\"># \u6709\u4e00\u5b9a Swap \u4f46\u4e0d\u4f9d\u8d56\u5b83<\/span><br \/>\n<span class=\"token comment\"># \u5efa\u8bae&#xff1a;\u7269\u7406\u5185\u5b58\u7684 25%-50%&#xff0c;\u4f46\u4f7f\u7528 SSD \u4ea4\u6362\u5206\u533a<\/span><br \/>\nvm.swappiness <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">10<\/span>  <span class=\"token comment\"># \u8f83\u4f4e\u503c&#xff0c;\u51cf\u5c11\u4e3b\u52a8\u4ea4\u6362<\/span><br \/>\nvm.vfs_cache_pressure <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">100<\/span><\/p>\n<h4>4. \u4f7f\u7528 cgroups \u786c\u6027\u9650\u5236&#xff08;\u63a8\u8350&#xff09;<\/h4>\n<p><span class=\"token comment\"># \u521b\u5efa cgroup \u9650\u5236 MySQL \u603b\u5185\u5b58\u4f7f\u7528<\/span><br \/>\ncgcreate -g memory:mysql<br \/>\n<span class=\"token comment\"># \u8bbe\u7f6e\u5185\u5b58\u9650\u5236\u4e3a\u7269\u7406\u5185\u5b58\u7684 85%<\/span><br \/>\ncgset -r memory.limit_in_bytes<span class=\"token operator\">&#061;<\/span><span class=\"token number\">85<\/span>%\u7269\u7406\u5185\u5b58 mysql<br \/>\ncgset -r memory.memsw.limit_in_bytes<span class=\"token operator\">&#061;<\/span>\u7269\u7406\u5185\u5b58&#043;\u9002\u5f53Swap mysql<\/p>\n<p><span class=\"token comment\"># \u5c06 MySQL \u8fdb\u7a0b\u52a0\u5165 cgroup<\/span><br \/>\ncgclassify -g memory:mysql <span class=\"token variable\"><span class=\"token variable\">$(<\/span>pgrep mysqld<span class=\"token variable\">)<\/span><\/span><\/p>\n<p>\u6216\u8005 systemd \u670d\u52a1\u6587\u4ef6\u914d\u7f6e&#xff1a;<\/p>\n<p>[Service]<br \/>\nMemoryMax&#061;85%  # \u786c\u9650\u5236<br \/>\nMemorySwapMax&#061;10%  # \u9650\u5236 Swap \u4f7f\u7528<br \/>\nMemoryHigh&#061;80%  # \u8f6f\u9650\u5236&#xff0c;\u8d85\u8fc7\u65f6\u5f00\u59cb\u56de\u6536<\/p>\n<h4>5. \u76d1\u63a7\u548c\u9884\u8b66\u7cfb\u7edf<\/h4>\n<p><span class=\"token comment\">&#8212; \u76d1\u63a7 MySQL \u5185\u5b58\u4f7f\u7528<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> <span class=\"token operator\">*<\/span> <span class=\"token keyword\">FROM<\/span> sys<span class=\"token punctuation\">.<\/span>memory_global_by_current_bytes<br \/>\n<span class=\"token keyword\">WHERE<\/span> event_name <span class=\"token operator\">NOT<\/span> <span class=\"token operator\">LIKE<\/span> <span class=\"token string\">&#039;memory\/performance_schema%&#039;<\/span><br \/>\n<span class=\"token keyword\">LIMIT<\/span> <span class=\"token number\">10<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token comment\">&#8212; \u67e5\u770b\u8fde\u63a5\u5185\u5b58\u4f7f\u7528<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> <span class=\"token operator\">*<\/span> <span class=\"token keyword\">FROM<\/span> sys<span class=\"token punctuation\">.<\/span>memory_by_thread_by_current_bytes<br \/>\n<span class=\"token keyword\">LIMIT<\/span> <span class=\"token number\">10<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token comment\"># \u76d1\u63a7\u7cfb\u7edf\u5185\u5b58\u8d8b\u52bf<\/span><br \/>\n<span class=\"token function\">cat<\/span> <span class=\"token operator\">&gt;<\/span> \/usr\/local\/bin\/memwatch.sh <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">&#039;EOF&#039;<br \/>\n#!\/bin\/bash<br \/>\nCOMMITTED&#061;$(grep Committed_AS \/proc\/meminfo | awk &#039;{print $2}&#039;)<br \/>\nLIMIT&#061;$(grep CommitLimit \/proc\/meminfo | awk &#039;{print $2}&#039;)<br \/>\nPERCENT&#061;$((COMMITTED*100\/LIMIT))<br \/>\necho &#034;\u5185\u5b58\u627f\u8bfa\u4f7f\u7528\u7387: ${PERCENT}%&#034;<br \/>\nif [ $PERCENT -gt 90 ]; then<br \/>\n    echo &#034;\u8b66\u544a: \u5185\u5b58\u63a5\u8fd1\u8fc7\u5ea6\u5206\u914d\u6781\u9650!&#034;<br \/>\n    # \u89e6\u53d1\u8b66\u62a5<br \/>\nfi<br \/>\nEOF<\/span><\/p>\n<h4>6. \u914d\u7f6e MySQL \u5185\u5b58\u5206\u914d\u5931\u8d25\u5904\u7406<\/h4>\n<p># my.cnf<br \/>\n[mysqld]<br \/>\n# \u4f7f MySQL \u5728\u5185\u5b58\u4e0d\u8db3\u65f6\u4f18\u96c5\u964d\u7ea7<br \/>\ninnodb_use_sys_malloc &#061; 0  # \u4f7f\u7528\u81ea\u5df1\u7684\u5185\u5b58\u5206\u914d\u5668<br \/>\n# \u5b9a\u671f\u68c0\u67e5\u5185\u5b58\u4f7f\u7528<br \/>\nperformance_schema_max_memory_classes &#061; 320<\/p>\n<h4>7. \u786c\u4ef6\u548c\u5185\u6838\u8c03\u4f18<\/h4>\n<p><span class=\"token comment\"># \u589e\u52a0\u5185\u5b58\u8fc7\u91cf\u4f7f\u7528\u65f6\u7684\u54cd\u5e94\u6027<\/span><br \/>\nvm.oom_dump_tasks <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">1<\/span>  <span class=\"token comment\"># OOM\u65f6\u8bb0\u5f55\u8fdb\u7a0b\u4fe1\u606f<\/span><br \/>\nvm.panic_on_oom <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span>    <span class=\"token comment\"># \u4e0d\u8981panic&#xff0c;\u8ba9OOM killer\u5de5\u4f5c<\/span><br \/>\nvm.oom_kill_allocating_task <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><\/p>\n<p><span class=\"token comment\"># \u4f7f\u7528\u900f\u660e\u5927\u9875\u53ef\u80fd\u589e\u52a0\u5185\u5b58\u538b\u529b\u98ce\u9669<\/span><br \/>\n<span class=\"token comment\"># \u5bf9\u4e8eMySQL&#xff0c;\u901a\u5e38\u5efa\u8bae\u5173\u95ed\u900f\u660e\u5927\u9875<\/span><br \/>\n<span class=\"token builtin class-name\">echo<\/span> never <span class=\"token operator\">&gt;<\/span> \/sys\/kernel\/mm\/transparent_hugepage\/enabled<\/p>\n<h3>\u5f53 OOM \u4e0d\u53ef\u907f\u514d\u65f6<\/h3>\n<p>\u5982\u679c\u5373\u4f7f\u91c7\u53d6\u4e0a\u8ff0\u63aa\u65bd\u4ecd\u7136\u53ef\u80fd\u89e6\u53d1 OOM&#xff0c;\u914d\u7f6e\u5e94\u6025\u63aa\u65bd&#xff1a;<\/p>\n<h4>1. OOM \u540e\u81ea\u52a8\u6062\u590d<\/h4>\n<p><span class=\"token comment\"># \u5728 \/etc\/systemd\/system\/mysql.service.d\/oom-recovery.conf<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>Service<span class=\"token punctuation\">]<\/span><br \/>\n<span class=\"token assign-left variable\">Restart<\/span><span class=\"token operator\">&#061;<\/span>on-failure<br \/>\n<span class=\"token assign-left variable\">RestartSec<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">10<\/span><br \/>\n<span class=\"token assign-left variable\">OOMScoreAdjust<\/span><span class=\"token operator\">&#061;<\/span>-1000<\/p>\n<h4>2. \u914d\u7f6e\u4f18\u5148\u6740\u6b7b\u8f85\u52a9\u8fdb\u7a0b<\/h4>\n<p><span class=\"token comment\"># \u5982\u679c\u6709\u76d1\u63a7\u6216\u5176\u4ed6\u8f85\u52a9\u8fdb\u7a0b&#xff0c;\u964d\u4f4e\u5176\u4f18\u5148\u7ea7<\/span><br \/>\n<span class=\"token keyword\">for<\/span> <span class=\"token for-or-select variable\">pid<\/span> <span class=\"token keyword\">in<\/span> <span class=\"token variable\"><span class=\"token variable\">$(<\/span>pgrep monitoring-agent<span class=\"token variable\">)<\/span><\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">do<\/span><br \/>\n    <span class=\"token builtin class-name\">echo<\/span> <span class=\"token number\">1000<\/span> <span class=\"token operator\">&gt;<\/span> \/proc\/<span class=\"token variable\">$pid<\/span>\/oom_score_adj<br \/>\n<span class=\"token keyword\">done<\/span><\/p>\n<h4>3. \u4f7f\u7528\u5185\u6838\u538b\u529b stall \u4fe1\u606f<\/h4>\n<p><span class=\"token comment\"># \u76d1\u63a7\u5185\u5b58\u538b\u529b\u65e9\u671f\u9884\u8b66<\/span><br \/>\n<span class=\"token builtin class-name\">echo<\/span> <span class=\"token number\">10000<\/span> <span class=\"token operator\">&gt;<\/span> \/proc\/sys\/vm\/watermark_scale_factor<\/p>\n<h3>\u603b\u7ed3<\/h3>\n<p>\u5bf9\u4e8e\u4e13\u7528 MySQL \u670d\u52a1\u5668&#xff0c;\u9632\u5fa1 OOM \u7684\u5173\u952e\u987a\u5e8f&#xff1a;<\/p>\n<li>\u9996\u8981&#xff1a;\u7981\u7528 overcommit (vm.overcommit_memory&#061;2)<\/li>\n<li>\u5176\u6b21&#xff1a;\u5408\u7406\u914d\u7f6e MySQL \u5185\u5b58\u53c2\u6570&#xff0c;\u7559\u8db3\u7cfb\u7edf\u5f00\u9500<\/li>\n<li>\u518d\u6b21&#xff1a;\u4f7f\u7528 cgroups \u786c\u9650\u5236 MySQL \u603b\u5185\u5b58<\/li>\n<li>\u7136\u540e&#xff1a;\u914d\u7f6e\u9002\u5f53\u7684\u76d1\u63a7\u548c\u9884\u8b66<\/li>\n<li>\u6700\u540e&#xff1a;\u51c6\u5907 OOM \u53d1\u751f\u540e\u7684\u6062\u590d\u65b9\u6848<\/li>\n<p>\u6700\u6839\u672c\u7684\u89e3\u51b3\u65b9\u6848&#xff1a;\u786e\u4fdd\u7269\u7406\u5185\u5b58\u8db3\u591f&#xff0c;\u5e76\u6709\u9002\u5f53\u7684\u4f59\u91cf&#xff08;\u901a\u5e38\u5efa\u8bae MySQL \u4e13\u7528\u670d\u52a1\u5668\u4e0a&#xff0c;InnoDB Buffer Pool \u4e0d\u8d85\u8fc7\u7269\u7406\u5185\u5b58\u7684 75%&#xff09;\u3002<\/p>\n<p>\u8fd9\u6837\u914d\u7f6e\u540e&#xff0c;\u5373\u4f7f\u5185\u5b58\u4e0d\u8db3&#xff0c;MySQL \u4f1a\u6536\u5230\u5206\u914d\u5931\u8d25\u9519\u8bef&#xff08;\u53ef\u901a\u8fc7\u5e94\u7528\u7a0b\u5e8f\u5904\u7406&#xff09;&#xff0c;\u800c\u4e0d\u662f\u88ab\u7a81\u7136\u6740\u6b7b\u5bfc\u81f4\u6570\u636e\u635f\u574f\u6216\u590d\u5236\u4e2d\u65ad\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5bf9\u4e8e\u53ea\u8fd0\u884c MySQL \u7684\u670d\u52a1\u5668&#xff0c;\u5982\u679c\u89e6\u53d1 OOM&#xff0c;\u65e0\u8bba\u600e\u6837\u8bbe\u7f6e&#xff0c;\u6570\u636e\u5e93\u8fdb\u7a0b\u88ab\u6740\u6b7b\u51e0\u4e4e\u662f\u5fc5\u7136\u7684\u3002\u8fd9\u662f\u56e0\u4e3a&#xff1a;<br \/>\n\u4e3a\u4ec0\u4e48 MySQL \u603b\u662f\u9996\u5f53\u5176\u51b2&#xff1f;\u5185\u5b58\u5360\u7528\u6700\u5927<br \/>\n\u5728\u4e13\u7528 MySQL \u670d\u52a1\u5668\u4e0a&#xff0c;MySQL \u901a\u5e38\u5360\u7528 80-99% \u7684\u7269\u7406\u5185\u5b58&#xff08;\u5305\u62ec InnoDB Buffer Pool\u3001Key Buffer \u7b49&#xff09;&#xff0c;\u5176\u4ed6\u8fdb\u7a0b&#xff08;SSH\u3001\u76d1\u63a7\u7b49&amp;#xff<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,114,43],"topic":[],"class_list":["post-71088","post","type-post","status-publish","format-standard","hentry","category-server","tag-linux","tag-mysql","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux \u9488\u5bf9 MySQL \u4e13\u7528\u670d\u52a1\u5668\u7684 OOM \u9884\u9632\u7b56\u7565\u914d\u7f6e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/71088.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux \u9488\u5bf9 MySQL \u4e13\u7528\u670d\u52a1\u5668\u7684 OOM \u9884\u9632\u7b56\u7565\u914d\u7f6e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u5bf9\u4e8e\u53ea\u8fd0\u884c MySQL \u7684\u670d\u52a1\u5668&#xff0c;\u5982\u679c\u89e6\u53d1 OOM&#xff0c;\u65e0\u8bba\u600e\u6837\u8bbe\u7f6e&#xff0c;\u6570\u636e\u5e93\u8fdb\u7a0b\u88ab\u6740\u6b7b\u51e0\u4e4e\u662f\u5fc5\u7136\u7684\u3002\u8fd9\u662f\u56e0\u4e3a&#xff1a; \u4e3a\u4ec0\u4e48 MySQL \u603b\u662f\u9996\u5f53\u5176\u51b2&#xff1f;\u5185\u5b58\u5360\u7528\u6700\u5927 \u5728\u4e13\u7528 MySQL \u670d\u52a1\u5668\u4e0a&#xff0c;MySQL \u901a\u5e38\u5360\u7528 80-99% \u7684\u7269\u7406\u5185\u5b58&#xff08;\u5305\u62ec InnoDB Buffer Pool\u3001Key Buffer \u7b49&#xff09;&#xff0c;\u5176\u4ed6\u8fdb\u7a0b&#xff08;SSH\u3001\u76d1\u63a7\u7b49&amp;#xff\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/71088.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-02T22:41:07+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/71088.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/71088.html\",\"name\":\"Linux \u9488\u5bf9 MySQL \u4e13\u7528\u670d\u52a1\u5668\u7684 OOM \u9884\u9632\u7b56\u7565\u914d\u7f6e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-02T22:41:07+00:00\",\"dateModified\":\"2026-02-02T22:41:07+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/71088.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/71088.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/71088.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux \u9488\u5bf9 MySQL \u4e13\u7528\u670d\u52a1\u5668\u7684 OOM \u9884\u9632\u7b56\u7565\u914d\u7f6e\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux \u9488\u5bf9 MySQL \u4e13\u7528\u670d\u52a1\u5668\u7684 OOM \u9884\u9632\u7b56\u7565\u914d\u7f6e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/71088.html","og_locale":"zh_CN","og_type":"article","og_title":"Linux \u9488\u5bf9 MySQL \u4e13\u7528\u670d\u52a1\u5668\u7684 OOM \u9884\u9632\u7b56\u7565\u914d\u7f6e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u5bf9\u4e8e\u53ea\u8fd0\u884c MySQL \u7684\u670d\u52a1\u5668&#xff0c;\u5982\u679c\u89e6\u53d1 OOM&#xff0c;\u65e0\u8bba\u600e\u6837\u8bbe\u7f6e&#xff0c;\u6570\u636e\u5e93\u8fdb\u7a0b\u88ab\u6740\u6b7b\u51e0\u4e4e\u662f\u5fc5\u7136\u7684\u3002\u8fd9\u662f\u56e0\u4e3a&#xff1a; \u4e3a\u4ec0\u4e48 MySQL \u603b\u662f\u9996\u5f53\u5176\u51b2&#xff1f;\u5185\u5b58\u5360\u7528\u6700\u5927 \u5728\u4e13\u7528 MySQL \u670d\u52a1\u5668\u4e0a&#xff0c;MySQL \u901a\u5e38\u5360\u7528 80-99% \u7684\u7269\u7406\u5185\u5b58&#xff08;\u5305\u62ec InnoDB Buffer Pool\u3001Key Buffer \u7b49&#xff09;&#xff0c;\u5176\u4ed6\u8fdb\u7a0b&#xff08;SSH\u3001\u76d1\u63a7\u7b49&amp;#xff","og_url":"https:\/\/www.wsisp.com\/helps\/71088.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-02T22:41:07+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/71088.html","url":"https:\/\/www.wsisp.com\/helps\/71088.html","name":"Linux \u9488\u5bf9 MySQL \u4e13\u7528\u670d\u52a1\u5668\u7684 OOM \u9884\u9632\u7b56\u7565\u914d\u7f6e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-02T22:41:07+00:00","dateModified":"2026-02-02T22:41:07+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/71088.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/71088.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/71088.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Linux \u9488\u5bf9 MySQL \u4e13\u7528\u670d\u52a1\u5668\u7684 OOM \u9884\u9632\u7b56\u7565\u914d\u7f6e"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/71088","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=71088"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/71088\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=71088"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=71088"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=71088"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=71088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}