{"id":1303,"date":"2012-01-12T11:52:06","date_gmt":"2012-01-12T03:52:06","guid":{"rendered":"http:\/\/doophp.sinaapp.com\/?p=1303"},"modified":"2012-01-12T11:55:08","modified_gmt":"2012-01-12T03:55:08","slug":"mysql-perfornamce-tuning-cache-parameter","status":"publish","type":"post","link":"https:\/\/blog.vimge.com\/archives\/mysql\/mysql-perfornamce-tuning-cache-parameter.html","title":{"rendered":"MySQL \u6570\u636e\u5e93\u6027\u80fd\u4f18\u5316\u4e4b\u7f13\u5b58\u53c2\u6570\u4f18\u5316"},"content":{"rendered":"
\u6570\u636e\u5e93\u5c5e\u4e8e IO \u5bc6\u96c6\u578b\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u5176\u4e3b\u8981\u804c\u8d23\u5c31\u662f\u6570\u636e\u7684\u7ba1\u7406\u53ca\u5b58\u50a8\u5de5\u4f5c\u3002\u800c\u6211\u4eec\u77e5\u9053\uff0c\u4ece\u5185\u5b58\u4e2d\u8bfb\u53d6\u4e00\u4e2a\u6570\u636e\u5e93\u7684\u65f6\u95f4\u662f\u5fae\u79d2\u7ea7\u522b\uff0c\u800c\u4ece\u4e00\u5757\u666e\u901a\u786c\u76d8\u4e0a\u8bfb\u53d6\u4e00\u4e2aIO\u662f\u5728\u6beb\u79d2\u7ea7\u522b\uff0c\u4e8c\u8005\u76f8\u5dee3\u4e2a\u6570\u91cf\u7ea7\u3002\u6240\u4ee5\uff0c\u8981\u4f18\u5316\u6570\u636e\u5e93\uff0c\u9996\u5148\u7b2c\u4e00\u6b65\u9700\u8981\u4f18\u5316\u7684\u5c31\u662f IO\uff0c\u5c3d\u53ef\u80fd\u5c06\u78c1\u76d8IO\u8f6c\u5316\u4e3a\u5185\u5b58IO\u3002\u672c\u6587\u5148\u4ece MySQL \u6570\u636e\u5e93IO\u76f8\u5173\u53c2\u6570\uff08\u7f13\u5b58\u53c2\u6570\uff09\u7684\u89d2\u5ea6\u6765\u770b\u770b\u53ef\u4ee5\u901a\u8fc7\u54ea\u4e9b\u53c2\u6570\u8fdb\u884cIO\u4f18\u5316<\/em><\/strong>\uff1a<\/p>\n Query cache \u4f5c\u7528\u4e8e\u6574\u4e2a MySQL Instance\uff0c\u4e3b\u8981\u7528\u6765\u7f13\u5b58 MySQL \u4e2d\u7684 ResultSet\uff0c\u4e5f\u5c31\u662f\u4e00\u6761SQL\u8bed\u53e5\u6267\u884c\u7684\u7ed3\u679c\u96c6\uff0c\u6240\u4ee5\u4ec5\u4ec5\u53ea\u80fd\u9488\u5bf9select\u8bed\u53e5\u3002\u5f53\u6211\u4eec\u6253\u5f00\u4e86 Query Cache \u529f\u80fd\uff0cMySQL\u5728\u63a5\u53d7\u5230\u4e00\u6761select\u8bed\u53e5\u7684\u8bf7\u6c42\u540e\uff0c\u5982\u679c\u8be5\u8bed\u53e5\u6ee1\u8db3Query Cache\u7684\u8981\u6c42\uff08\u672a\u663e\u5f0f\u8bf4\u660e\u4e0d\u5141\u8bb8\u4f7f\u7528Query Cache\uff0c\u6216\u8005\u5df2\u7ecf\u663e\u5f0f\u7533\u660e\u9700\u8981\u4f7f\u7528Query Cache\uff09\uff0cMySQL \u4f1a\u76f4\u63a5\u6839\u636e\u9884\u5148\u8bbe\u5b9a\u597d\u7684HASH\u7b97\u6cd5\u5c06\u63a5\u53d7\u5230\u7684select\u8bed\u53e5\u4ee5\u5b57\u7b26\u4e32\u65b9\u5f0f\u8fdb\u884chash\uff0c\u7136\u540e\u5230Query Cache \u4e2d\u76f4\u63a5\u67e5\u627e\u662f\u5426\u5df2\u7ecf\u7f13\u5b58\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u5df2\u7ecf\u5728\u7f13\u5b58\u4e2d\uff0c\u8be5select\u8bf7\u6c42\u5c31\u4f1a\u76f4\u63a5\u5c06\u6570\u636e\u8fd4\u56de\uff0c\u4ece\u800c\u7701\u7565\u4e86\u540e\u9762\u6240\u6709\u7684\u6b65\u9aa4\uff08\u5982 SQL\u8bed\u53e5\u7684\u89e3\u6790\uff0c\u4f18\u5316\u5668\u4f18\u5316\u4ee5\u53ca\u5411\u5b58\u50a8\u5f15\u64ce\u8bf7\u6c42\u6570\u636e\u7b49\uff09\uff0c\u6781\u5927\u7684\u63d0\u9ad8\u6027\u80fd\u3002<\/p>\n \u5f53\u7136\uff0cQuery Cache \u4e5f\u6709\u4e00\u4e2a\u81f4\u547d\u7684\u7f3a\u9677\uff0c\u90a3\u5c31\u662f\u5f53\u67d0\u4e2a\u8868\u7684\u6570\u636e\u6709\u4efb\u4f55\u4efb\u4f55\u53d8\u5316\uff0c\u90fd\u4f1a\u5bfc\u81f4\u6240\u6709\u5f15\u7528\u4e86\u8be5\u8868\u7684select\u8bed\u53e5\u5728Query Cache \u4e2d\u7684\u7f13\u5b58\u6570\u636e\u5931\u6548\u3002\u6240\u4ee5\uff0c\u5f53\u6211\u4eec\u7684\u6570\u636e\u53d8\u5316\u975e\u5e38\u9891\u7e41\u7684\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528Query Cache \u53ef\u80fd\u4f1a\u5f97\u4e0d\u507f\u5931\u3002<\/p>\n Query Cache\u7684\u4f7f\u7528\u9700\u8981\u591a\u4e2a\u53c2\u6570\u914d\u5408\uff0c\u5176\u4e2d\u6700\u4e3a\u5173\u952e\u7684\u662f query_cache_size \u548c query_cache_type \uff0c\u524d\u8005\u8bbe\u7f6e\u7528\u4e8e\u7f13\u5b58 ResultSet \u7684\u5185\u5b58\u5927\u5c0f\uff0c\u540e\u8005\u8bbe\u7f6e\u5728\u4f55\u573a\u666f\u4e0b\u4f7f\u7528 Query Cache\u3002\u5728\u4ee5\u5f80\u7684\u7ecf\u9a8c\u6765\u770b\uff0c\u5982\u679c\u4e0d\u662f\u7528\u6765\u7f13\u5b58\u57fa\u672c\u4e0d\u53d8\u7684\u6570\u636e\u7684MySQL\u6570\u636e\u5e93\uff0cquery_cache_size \u4e00\u822c 256MB \u662f\u4e00\u4e2a\u6bd4\u8f83\u5408\u9002\u7684\u5927\u5c0f\u3002\u5f53\u7136\uff0c\u8fd9\u53ef\u4ee5\u901a\u8fc7\u8ba1\u7b97Query Cache\u7684\u547d\u4e2d\u7387\uff08Qcache_hits\/(Qcache_hits+Qcache_inserts)*100)\uff09\u6765\u8fdb\u884c\u8c03\u6574\u3002query_cache_type\u53ef\u4ee5\u8bbe\u7f6e\u4e3a0(OFF)\uff0c1(ON)\u6216\u80052(DEMOND)\uff0c\u5206\u522b\u8868\u793a\u5b8c\u5168\u4e0d\u4f7f\u7528query cache\uff0c\u9664\u663e\u5f0f\u8981\u6c42\u4e0d\u4f7f\u7528query cache\uff08\u4f7f\u7528sql_no_cache\uff09\u4e4b\u5916\u7684\u6240\u6709\u7684select\u90fd\u4f7f\u7528query cache\uff0c\u53ea\u6709\u663e\u793a\u8981\u6c42\u624d\u4f7f\u7528query cache\uff08\u4f7f\u7528sql_cache\uff09\u3002<\/p>\n Binlog Cache \u7528\u4e8e\u5728\u6253\u5f00\u4e86\u4e8c\u8fdb\u5236\u65e5\u5fd7\uff08binlog\uff09\u8bb0\u5f55\u529f\u80fd\u7684\u73af\u5883\uff0c\u662f MySQL \u7528\u6765\u63d0\u9ad8binlog\u7684\u8bb0\u5f55\u6548\u7387\u800c\u8bbe\u8ba1\u7684\u4e00\u4e2a\u7528\u4e8e\u77ed\u65f6\u95f4\u5185\u4e34\u65f6\u7f13\u5b58binlog\u6570\u636e\u7684\u5185\u5b58\u533a\u57df\u3002<\/p>\n \u4e00\u822c\u6765\u8bf4\uff0c\u5982\u679c\u6211\u4eec\u7684\u6570\u636e\u5e93\u4e2d\u6ca1\u6709\u4ec0\u4e48\u5927\u4e8b\u52a1\uff0c\u5199\u5165\u4e5f\u4e0d\u662f\u7279\u522b\u9891\u7e41\uff0c2MB\uff5e4MB\u662f\u4e00\u4e2a\u5408\u9002\u7684\u9009\u62e9\u3002\u4f46\u662f\u5982\u679c\u6211\u4eec\u7684\u6570\u636e\u5e93\u5927\u4e8b\u52a1\u8f83\u591a\uff0c\u5199\u5165\u91cf\u6bd4\u8f83\u5927\uff0c\u53ef\u4e0e\u9002\u5f53\u8c03\u9ad8binlog_cache_size\u3002\u540c\u65f6\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7binlog_cache_use \u4ee5\u53ca binlog_cache_disk_use\u6765\u5206\u6790\u8bbe\u7f6e\u7684binlog_cache_size\u662f\u5426\u8db3\u591f\uff0c\u662f\u5426\u6709\u5927\u91cf\u7684binlog_cache\u7531\u4e8e\u5185\u5b58\u5927\u5c0f\u4e0d\u591f\u800c\u4f7f\u7528\u4e34\u65f6\u6587\u4ef6\uff08binlog_cache_disk_use\uff09\u6765\u7f13\u5b58\u4e86\u3002<\/p>\n Key Buffer \u53ef\u80fd\u662f\u5927\u5bb6\u6700\u4e3a\u719f\u6089\u7684\u4e00\u4e2a MySQL \u7f13\u5b58\u53c2\u6570\u4e86\uff0c\u5c24\u5176\u662f\u5728 MySQL \u6ca1\u6709\u66f4\u6362\u9ed8\u8ba4\u5b58\u50a8\u5f15\u64ce\u7684\u65f6\u5019\uff0c\u5f88\u591a\u670b\u53cb\u53ef\u80fd\u4f1a\u53d1\u73b0\uff0c\u9ed8\u8ba4\u7684 MySQL \u914d\u7f6e\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u6700\u5927\u7684\u4e00\u4e2a\u5185\u5b58\u53c2\u6570\u5c31\u662f\u8fd9\u4e2a\u53c2\u6570\u4e86\u3002key_buffer_size \u53c2\u6570\u7528\u6765\u8bbe\u7f6e\u7528\u4e8e\u7f13\u5b58 MyISAM\u5b58\u50a8\u5f15\u64ce\u4e2d\u7d22\u5f15\u6587\u4ef6\u7684\u5185\u5b58\u533a\u57df\u5927\u5c0f\u3002\u5982\u679c\u6211\u4eec\u6709\u8db3\u591f\u7684\u5185\u5b58\uff0c\u8fd9\u4e2a\u7f13\u5b58\u533a\u57df\u6700\u597d\u662f\u80fd\u591f\u5b58\u653e\u4e0b\u6211\u4eec\u6240\u6709\u7684 MyISAM \u5f15\u64ce\u8868\u7684\u6240\u6709\u7d22\u5f15\uff0c\u4ee5\u5c3d\u53ef\u80fd\u63d0\u9ad8\u6027\u80fd\u3002<\/p>\n \u6b64\u5916\uff0c\u5f53\u6211\u4eec\u5728\u4f7f\u7528MyISAM \u5b58\u50a8\u7684\u65f6\u5019\u6709\u4e00\u4e2a\u53ca\u5176\u91cd\u8981\u7684\u70b9\u9700\u8981\u6ce8\u610f\uff0c\u7531\u4e8e MyISAM \u5f15\u64ce\u7684\u7279\u6027\u9650\u5236\u4e86\u4ed6\u4ec5\u4ec5\u53ea\u4f1a\u7f13\u5b58\u7d22\u5f15\u5757\u5230\u5185\u5b58\u4e2d\uff0c\u800c\u4e0d\u4f1a\u7f13\u5b58\u8868\u6570\u636e\u5e93\u5757\u3002\u6240\u4ee5\uff0c\u6211\u4eec\u7684 SQL \u4e00\u5b9a\u8981\u5c3d\u53ef\u80fd\u8ba9\u8fc7\u6ee4\u6761\u4ef6\u90fd\u5728\u7d22\u5f15\u4e2d\uff0c\u4ee5\u4fbf\u8ba9\u7f13\u5b58\u5e2e\u52a9\u6211\u4eec\u63d0\u9ad8\u67e5\u8be2\u6548\u7387\u3002<\/p>\n \u548ckey_buffer_size\u4e00\u6837\uff0c\u8fd9\u4e2a\u53c2\u6570\u540c\u6837\u4e5f\u4ec5\u4f5c\u7528\u4e8e\u4f7f\u7528 MyISAM\u5b58\u50a8\u5f15\u64ce\uff0c\u7528\u6765\u7f13\u5b58\u6279\u91cf\u63d2\u5165\u6570\u636e\u7684\u65f6\u5019\u4e34\u65f6\u7f13\u5b58\u5199\u5165\u6570\u636e\u3002\u5f53\u6211\u4eec\u4f7f\u7528\u5982\u4e0b\u51e0\u79cd\u6570\u636e\u5199\u5165\u8bed\u53e5\u7684\u65f6\u5019\uff0c\u4f1a\u4f7f\u7528\u8fd9\u4e2a\u5185\u5b58\u533a\u57df\u6765\u7f13\u5b58\u6279\u91cf\u7ed3\u6784\u7684\u6570\u636e\u4ee5\u5e2e\u52a9\u6279\u91cf\u5199\u5165\u6570\u636e\u6587\u4ef6\uff1a<\/p>\n insert \u2026 select \u2026 \u5f53\u6211\u4eec\u4f7f\u7528InnoDB\u5b58\u50a8\u5f15\u64ce\u7684\u65f6\u5019\uff0cinnodb_buffer_pool_size \u53c2\u6570\u53ef\u80fd\u662f\u5f71\u54cd\u6211\u4eec\u6027\u80fd\u7684\u6700\u4e3a\u5173\u952e\u7684\u4e00\u4e2a\u53c2\u6570\u4e86\uff0c\u4ed6\u7528\u6765\u8bbe\u7f6e\u7528\u4e8e\u7f13\u5b58 InnoDB \u7d22\u5f15\u53ca\u6570\u636e\u5757\u7684\u5185\u5b58\u533a\u57df\u5927\u5c0f\uff0c\u7c7b\u4f3c\u4e8e MyISAM \u5b58\u50a8\u5f15\u64ce\u7684 key_buffer_size \u53c2\u6570\uff0c\u5f53\u7136\uff0c\u53ef\u80fd\u66f4\u50cf\u662f Oracle \u7684 db_cache_size\u3002\u7b80\u5355\u6765\u8bf4\uff0c\u5f53\u6211\u4eec\u64cd\u4f5c\u4e00\u4e2a InnoDB \u8868\u7684\u65f6\u5019\uff0c\u8fd4\u56de\u7684\u6240\u6709\u6570\u636e\u6216\u8005\u53bb\u6570\u636e\u8fc7\u7a0b\u4e2d\u7528\u5230\u7684\u4efb\u4f55\u4e00\u4e2a\u7d22\u5f15\u5757\uff0c\u90fd\u4f1a\u5728\u8fd9\u4e2a\u5185\u5b58\u533a\u57df\u4e2d\u8d70\u4e00\u906d\u3002<\/p>\n \u548ckey_buffer_size \u5bf9\u4e8e MyISAM \u5f15\u64ce\u4e00\u6837\uff0cinnodb_buffer_pool_size \u8bbe\u7f6e\u4e86 InnoDB \u5b58\u50a8\u5f15\u64ce\u9700\u6c42\u6700\u5927\u7684\u4e00\u5757\u5185\u5b58\u533a\u57df\u7684\u5927\u5c0f\uff0c\u76f4\u63a5\u5173\u7cfb\u5230 InnoDB\u5b58\u50a8\u5f15\u64ce\u7684\u6027\u80fd\uff0c\u6240\u4ee5\u5982\u679c\u6211\u4eec\u6709\u8db3\u591f\u7684\u5185\u5b58\uff0c\u5c3d\u53ef\u5c06\u8be5\u53c2\u6570\u8bbe\u7f6e\u5230\u8db3\u591f\u6253\uff0c\u5c06\u5c3d\u53ef\u80fd\u591a\u7684 InnoDB \u7684\u7d22\u5f15\u53ca\u6570\u636e\u90fd\u653e\u5165\u5230\u8be5\u7f13\u5b58\u533a\u57df\u4e2d\uff0c\u76f4\u81f3\u5168\u90e8\u3002<\/p>\n \u6211\u4eec\u53ef\u4ee5\u901a\u8fc7 (Innodb_buffer_pool_read_requests \u2013 Innodb_buffer_pool_reads) \/ Innodb_buffer_pool_read_requests * 100% \u8ba1\u7b97\u7f13\u5b58\u547d\u4e2d\u7387\uff0c\u5e76\u6839\u636e\u547d\u4e2d\u7387\u6765\u8c03\u6574 innodb_buffer_pool_size \u53c2\u6570\u5927\u5c0f\u8fdb\u884c\u4f18\u5316\u3002<\/p>\n \u8fd9\u4e2a\u53c2\u6570\u6211\u4eec\u5e73\u65f6\u8c03\u6574\u7684\u53ef\u80fd\u4e0d\u662f\u592a\u591a\uff0c\u5f88\u591a\u4eba\u90fd\u4f7f\u7528\u4e86\u9ed8\u8ba4\u503c\uff0c\u53ef\u80fd\u5f88\u591a\u4eba\u90fd\u4e0d\u662f\u592a\u719f\u6089\u8fd9\u4e2a\u53c2\u6570\u7684\u4f5c\u7528\u3002innodb_additional_mem_pool_size \u8bbe\u7f6e\u4e86InnoDB\u5b58\u50a8\u5f15\u64ce\u7528\u6765\u5b58\u653e\u6570\u636e\u5b57\u5178\u4fe1\u606f\u4ee5\u53ca\u4e00\u4e9b\u5185\u90e8\u6570\u636e\u7ed3\u6784\u7684\u5185\u5b58\u7a7a\u95f4\u5927\u5c0f\uff0c\u6240\u4ee5\u5f53\u6211\u4eec\u4e00\u4e2aMySQL Instance\u4e2d\u7684\u6570\u636e\u5e93\u5bf9\u8c61\u975e\u5e38\u591a\u7684\u65f6\u5019\uff0c\u662f\u9700\u8981\u9002\u5f53\u8c03\u6574\u8be5\u53c2\u6570\u7684\u5927\u5c0f\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u5b58\u653e\u5728\u5185\u5b58\u4e2d\u63d0\u9ad8\u8bbf\u95ee\u6548\u7387\u7684\u3002<\/p>\n \u8fd9\u4e2a\u53c2\u6570\u5927\u5c0f\u662f\u5426\u8db3\u591f\u8fd8\u662f\u6bd4\u8f83\u5bb9\u6613\u77e5\u9053\u7684\uff0c\u56e0\u4e3a\u5f53\u8fc7\u5c0f\u7684\u65f6\u5019\uff0cMySQL \u4f1a\u8bb0\u5f55 Warning \u4fe1\u606f\u5230\u6570\u636e\u5e93\u7684 error log \u4e2d\uff0c\u8fd9\u65f6\u5019\u4f60\u5c31\u77e5\u9053\u8be5\u8c03\u6574\u8fd9\u4e2a\u53c2\u6570\u5927\u5c0f\u4e86\u3002<\/p>\n \u8fd9\u662f InnoDB \u5b58\u50a8\u5f15\u64ce\u7684\u4e8b\u52a1\u65e5\u5fd7\u6240\u4f7f\u7528\u7684\u7f13\u51b2\u533a\u3002\u7c7b\u4f3c\u4e8e Binlog Buffer\uff0cInnoDB \u5728\u5199\u4e8b\u52a1\u65e5\u5fd7\u7684\u65f6\u5019\uff0c\u4e3a\u4e86\u63d0\u9ad8\u6027\u80fd\uff0c\u4e5f\u662f\u5148\u5c06\u4fe1\u606f\u5199\u5165 Innofb Log Buffer \u4e2d\uff0c\u5f53\u6ee1\u8db3 innodb_flush_log_trx_commit \u53c2\u6570\u6240\u8bbe\u7f6e\u7684\u76f8\u5e94\u6761\u4ef6\uff08\u6216\u8005\u65e5\u5fd7\u7f13\u51b2\u533a\u5199\u6ee1\uff09\u4e4b\u540e\uff0c\u624d\u4f1a\u5c06\u65e5\u5fd7\u5199\u5230\u6587\u4ef6\uff08\u6216\u8005\u540c\u6b65\u5230\u78c1\u76d8\uff09\u4e2d\u3002\u53ef\u4ee5\u901a\u8fc7 innodb_log_buffer_size \u53c2\u6570\u8bbe\u7f6e\u5176\u53ef\u4ee5\u4f7f\u7528\u7684\u6700\u5927\u5185\u5b58\u7a7a\u95f4\u3002 0\uff1alog buffer\u4e2d\u7684\u6570\u636e\u5c06\u4ee5\u6bcf\u79d2\u4e00\u6b21\u7684\u9891\u7387\u5199\u5165\u5230log file\u4e2d\uff0c\u4e14\u540c\u65f6\u4f1a\u8fdb\u884c\u6587\u4ef6\u7cfb\u7edf\u5230\u78c1\u76d8\u7684\u540c\u6b65\u64cd\u4f5c\uff0c\u4f46\u662f\u6bcf\u4e2a\u4e8b\u52a1\u7684commit\u5e76\u4e0d\u4f1a\u89e6\u53d1\u4efb\u4f55log buffer \u5230log file\u7684\u5237\u65b0\u6216\u8005\u6587\u4ef6\u7cfb\u7edf\u5230\u78c1\u76d8\u7684\u5237\u65b0\u64cd\u4f5c\uff1b \u6b64\u5916\uff0cMySQL\u6587\u6863\u4e2d\u8fd8\u63d0\u5230\uff0c\u8fd9\u51e0\u79cd\u8bbe\u7f6e\u4e2d\u7684\u6bcf\u79d2\u540c\u6b65\u4e00\u6b21\u7684\u673a\u5236\uff0c\u53ef\u80fd\u5e76\u4e0d\u4f1a\u5b8c\u5168\u786e\u4fdd\u975e\u5e38\u51c6\u786e\u7684\u6bcf\u79d2\u5c31\u4e00\u5b9a\u4f1a\u53d1\u751f\u540c\u6b65\uff0c\u8fd8\u53d6\u51b3\u4e8e\u8fdb\u7a0b\u8c03\u5ea6\u7684\u95ee\u9898\u3002\u5b9e\u9645\u4e0a\uff0cInnoDB \u80fd\u5426\u771f\u6b63\u6ee1\u8db3\u6b64\u53c2\u6570\u6240\u8bbe\u7f6e\u503c\u4ee3\u8868\u7684\u610f\u4e49\u6b63\u5e38 Recovery \u8fd8\u662f\u53d7\u5230\u4e86\u4e0d\u540c OS \u4e0b\u6587\u4ef6\u7cfb\u7edf\u4ee5\u53ca\u78c1\u76d8\u672c\u8eab\u7684\u9650\u5236\uff0c\u53ef\u80fd\u6709\u4e9b\u65f6\u5019\u5728\u5e76\u6ca1\u6709\u771f\u6b63\u5b8c\u6210\u78c1\u76d8\u540c\u6b65\u7684\u60c5\u51b5\u4e0b\u4e5f\u4f1a\u544a\u8bc9 mysqld \u5df2\u7ecf\u5b8c\u6210\u4e86\u78c1\u76d8\u540c\u6b65\u3002<\/p>\n \u8fd9\u4e2a\u53c2\u6570\u548c\u4e0a\u9762\u7684\u5404\u4e2a\u53c2\u6570\u4e0d\u540c\uff0c\u4ed6\u4e0d\u662f\u7528\u6765\u8bbe\u7f6e\u7528\u4e8e\u7f13\u5b58\u67d0\u79cd\u6570\u636e\u7684\u5185\u5b58\u5927\u5c0f\u7684\u4e00\u4e2a\u53c2\u6570\uff0c\u800c\u662f\u7528\u6765\u63a7\u5236\u5728 InnoDB Buffer Pool \u4e2d\u53ef\u4ee5\u4e0d\u7528\u5199\u5165\u6570\u636e\u6587\u4ef6\u4e2d\u7684Dirty Page \u7684\u6bd4\u4f8b\uff08\u5df2\u7ecf\u88ab\u4fee\u4f46\u8fd8\u6ca1\u6709\u4ece\u5185\u5b58\u4e2d\u5199\u5165\u5230\u6570\u636e\u6587\u4ef6\u7684\u810f\u6570\u636e\uff09\u3002\u8fd9\u4e2a\u6bd4\u4f8b\u503c\u8d8a\u5927\uff0c\u4ece\u5185\u5b58\u5230\u78c1\u76d8\u7684\u5199\u5165\u64cd\u4f5c\u5c31\u4f1a\u76f8\u5bf9\u51cf\u5c11\uff0c\u6240\u4ee5\u80fd\u591f\u4e00\u5b9a\u7a0b\u5ea6\u4e0b\u51cf\u5c11\u5199\u5165\u64cd\u4f5c\u7684\u78c1\u76d8IO\u3002<\/p>\n \u4f46\u662f\uff0c\u5982\u679c\u8fd9\u4e2a\u6bd4\u4f8b\u503c\u8fc7\u5927\uff0c\u5f53\u6570\u636e\u5e93 Crash \u4e4b\u540e\u91cd\u542f\u7684\u65f6\u95f4\u53ef\u80fd\u5c31\u4f1a\u5f88\u957f\uff0c\u56e0\u4e3a\u4f1a\u6709\u5927\u91cf\u7684\u4e8b\u52a1\u6570\u636e\u9700\u8981\u4ece\u65e5\u5fd7\u6587\u4ef6\u6062\u590d\u51fa\u6765\u5199\u5165\u6570\u636e\u6587\u4ef6\u4e2d\u3002\u540c\u65f6\uff0c\u8fc7\u5927\u7684\u6bd4\u4f8b\u503c\u540c\u65f6\u53ef\u80fd\u4e5f\u4f1a\u9020\u6210\u5728\u8fbe\u5230\u6bd4\u4f8b\u8bbe\u5b9a\u4e0a\u9650\u540e\u7684 flush \u64cd\u4f5c\u201c\u8fc7\u731b\u201d\u800c\u5bfc\u81f4\u6027\u80fd\u6ce2\u52a8\u5f88\u5927\u3002<\/p>\n\n
\n
\n
\n
\n
\n
\n
\n
\ninsert \u2026 values (\u2026) ,(\u2026),(\u2026)\u2026
\nload data infile\u2026 into\u2026 (\u975e\u7a7a\u8868)<\/p>\n\n
\n
\n
\n
\n
\n
\n\u6ce8\uff1ainnodb_flush_log_trx_commit \u53c2\u6570\u5bf9 InnoDB Log \u7684\u5199\u5165\u6027\u80fd\u6709\u975e\u5e38\u5173\u952e\u7684\u5f71\u54cd\u3002\u8be5\u53c2\u6570\u53ef\u4ee5\u8bbe\u7f6e\u4e3a0\uff0c1\uff0c2\uff0c\u89e3\u91ca\u5982\u4e0b\uff1a<\/p>\n
\n1\uff1a\u5728\u6bcf\u6b21\u4e8b\u52a1\u63d0\u4ea4\u7684\u65f6\u5019\u5c06log buffer \u4e2d\u7684\u6570\u636e\u90fd\u4f1a\u5199\u5165\u5230log file\uff0c\u540c\u65f6\u4e5f\u4f1a\u89e6\u53d1\u6587\u4ef6\u7cfb\u7edf\u5230\u78c1\u76d8\u7684\u540c\u6b65\uff1b
\n2\uff1a\u4e8b\u52a1\u63d0\u4ea4\u4f1a\u89e6\u53d1log buffer \u5230log file\u7684\u5237\u65b0\uff0c\u4f46\u5e76\u4e0d\u4f1a\u89e6\u53d1\u78c1\u76d8\u6587\u4ef6\u7cfb\u7edf\u5230\u78c1\u76d8\u7684\u540c\u6b65\u3002\u6b64\u5916\uff0c\u6bcf\u79d2\u4f1a\u6709\u4e00\u6b21\u6587\u4ef6\u7cfb\u7edf\u5230\u78c1\u76d8\u540c\u6b65\u64cd\u4f5c\u3002<\/p>\n\n
\n