{"id":1680,"date":"2010-04-04T09:21:56","date_gmt":"2010-04-04T01:21:56","guid":{"rendered":"http:\/\/www.orczhou.com\/?p=1680"},"modified":"2010-04-04T09:25:32","modified_gmt":"2010-04-04T01:25:32","slug":"innodb-plugin-some-feature-1","status":"publish","type":"post","link":"https:\/\/www.orczhou.com\/index.php\/2010\/04\/innodb-plugin-some-feature-1\/","title":{"rendered":"InnoDB Plugin\u7279\u6027\u4ecb\u7ecd-1"},"content":{"rendered":"<p>\u8feb\u4e8e\u5f00\u6e90\u793e\u533a\u3001\u56e2\u4f53\uff08Google Facebook Percona  Xaprb\u7b49\uff09\u7684\u5de8\u5927\u538b\u529b\uff0cInnoDB Plugin\u76f8\u6bd4Built-in\u7248\u672c\u6709\u4e86\u5f88\u5927\u7684\u63d0\u5347\uff0c\u8fd9\u4e9b\u63d0\u5347\u591a\u6570\u6765\u81ea\u5f00\u6e90\u793e\u533a\u8d21\u732e\u7684\u4ee3\u7801\uff0c\u867d\u7136\u672c\u8eab\u4e5f\u6709\u4e00\u4e9b\u6539\u8fdb\u3002<\/p>\n<p><font color=\"red\">1. \u5173\u4e8eFast locking<\/font><\/p>\n<p>\u5728\u591a\u4e2a\u7ebf\u7a0b\u5e76\u53d1\u8bbf\u95ee\u76f8\u540c\u8d44\u6e90\u7684\u65f6\u5019\uff0c\u9700\u8981\u4f7f\u7528\u4e00\u4e9bInnoDB\u5b9e\u73b0\u7684\u4e92\u65a5\u91cf\uff08mutex\uff09\u548c\u8bfb\u5199\u9501\uff08read\/write lock\uff09\u3002\u5728Unix-like\u5e73\u53f0\u4e0a\uff0cInnoDB\u662f\u901a\u8fc7Pthread\u7684\u4e92\u65a5\u91cf\uff08\u8fd9\u662fPOSIX\u6807\u51c6\u7684\u4e00\u90e8\u5206\uff09\u6765\u5b9e\u73b0\u7684\u3002\u5728\u73b0\u4ee3OS\u548c\u786c\u4ef6\u5e73\u53f0\u4e2d\uff0c\u4e00\u822c\u90fd\u6709\u4e86\u66f4\u6709\u6548\u7684\u66ff\u4ee3\u65b9\u6848\uff0c\u591a\u6570\u60c5\u51b5\u4e0b\u8fd9\u4e9b\u66ff\u4ee3\u65b9\u6848\u4f7f\u7528\u66f4\u5c11\u7684CPU\u6307\u4ee4\u548c\u65f6\u949f\u5468\u671f\u6765\u5b8c\u6210\u8fd9\u4e9b\u4e92\u65a5\u5904\u7406\u3002<br \/>\n<!--more--><\/p>\n<p>\u4eceInnoDB1.0.3\u5f00\u59cb\uff0c\u5982\u679c\u4f60\u4f7f\u7528\u7684GCC\u7248\u672c\u9ad8\u4e8e4.12\uff0c\u90a3\u4e48\u4e92\u65a5\u91cf\uff08mutex\uff09\u548c\u8bfb\u5199\u9501\uff08read\/write lock\uff09\u53ef\u4ee5\u901a\u8fc7GCC\u5185\u7f6e\u7684<a href=\"http:\/\/gcc.gnu.org\/onlinedocs\/gcc-4.1.2\/gcc\/Atomic-Builtins.html\">atomic_memory_access<\/a>\u529f\u80fd\u6765\u5b9e\u73b0\uff1b\u5982\u679c\u4f60\u662f\u5728Solaris 10\u4e0a\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u7cfb\u7edf\u81ea\u5e26\u7684<a href=\"http:\/\/docs.sun.com\/app\/docs\/doc\/816-5168\/atomic-ops-3c\">atomic_operations<\/a>\u529f\u80fd\u6765\u5b9e\u73b0\u4e92\u65a5\u91cf\uff08mutex\uff09\u548c\u8bfb\u5199\u9501\uff08read\/write lock\uff09\u3002<\/p>\n<p>\u5728\u7f16\u8bd1\u65f6\uff0cInnoDB\u5982\u679c\u68c0\u6d4b\u5230\u4e86GCC\u7684<a href=\"http:\/\/gcc.gnu.org\/onlinedocs\/gcc-4.1.2\/gcc\/Atomic-Builtins.html\">atomic_memory_access<\/a>\u5219\u4f1a\u4f7f\u7528\u8be5\u529f\u80fd\uff0c\u5426\u5219\u5982\u679c\u68c0\u6d4b\u5230\u6709Solaris 10\u7684<a href=\"http:\/\/docs.sun.com\/app\/docs\/doc\/816-5168\/atomic-ops-3c\">atomic_operations<\/a>\uff0c\u5219\u4f1a\u4f7f\u7528\u8be5\u529f\u80fd\u3002\u5982\u679c\uff0c\u4e0a\u9762\u6761\u4ef6\u90fd\u4e0d\u6ee1\u8db3\uff0c\u5219\u4f1a\u4f7f\u7528InnoDB\u4f7f\u7528POSIX Pthread\u5b9e\u73b0\u7684InnoDB\u4e92\u65a5\u91cf\uff08mutex\uff09\u548c\u8bfb\u5199\u9501\uff08read\/write lock\uff09\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u8fd9\u4e2a\u7279\u6027\u4e0d\u9700\u8981\u6211\u4eec\u505a\u4efb\u4f55\u914d\u7f6e\u3002\u5728InnoDB\u542f\u52a8\u7684\u65f6\u5019\uff0c\u4f1a\u5728\u9519\u8bef\u65e5\u5fd7\u6253\u5370\u76f8\u5173\u4fe1\u606f\u3002\u5982\u679cInnoDB\u4f7f\u7528POSIX Pthread\u5b9e\u73b0\u4e92\u65a5\u91cf\u548c\u8bfb\u5199\u9501\u5c06\u6253\u5370\u5982\u4e0b\u4fe1\u606f\uff1a<\/p>\n<blockquote><p>InnoDB: Mutexes and rw_locks use InnoDB&#8217;s own implementation<\/p><\/blockquote>\n<p>\u5982\u679c\u4f7f\u7528GCC\u7684<a href=\"http:\/\/gcc.gnu.org\/onlinedocs\/gcc-4.1.2\/gcc\/Atomic-Builtins.html\">atomic memory access<\/a>\u7279\u6027\uff1a<\/p>\n<blockquote><p>InnoDB:\u00a0Mutexes\u00a0and\u00a0rw_locks\u00a0use\u00a0GCC\u00a0atomic\u00a0builtins<\/p><\/blockquote>\n<p><font color=\"red\">2. \u5173\u4e8e\u5185\u5b58\u5206\u914d<\/font><\/p>\n<p>\u5728InnoDB\u521a\u521a\u88ab\u5f00\u53d1\u7684\u65f6\u5019\uff0c\u5f53\u65f6\u591a\u6838CPU\u8fd8\u5e76\u4e0d\u662f\u8fd9\u4e48\u6d41\u884c\uff0c\u5f53\u65f6\u4e5f\u5e76\u6ca1\u6709\u9488\u5bf9\u591a\u6838CPU\u4f18\u5316\u7684\u5185\u5b58\u5206\u914d\u5668\uff08memory allocator libraries \uff09\uff0c\u6240\u4ee5InnoDB\u5b9e\u73b0\u4e86\u4e00\u4e2a\u81ea\u5df1\u7684\u5185\u5b58\u5206\u914d\u5b50\u7cfb\u7edf\uff08mem subsystem\uff09\uff0c\u8fd9\u4e2a\u5b50\u7cfb\u7edf\u662f\u901a\u8fc7\u5355\u4e2a\u4e92\u65a5\u91cf\uff08mutex\uff09\u5b9e\u73b0\u7ba1\u7406\u7684\uff0c\u800c\u8fd9\u53ef\u80fd\u662f\u4e00\u4e2a\u74f6\u9888\u3002\u9664\u6b64\uff0cInnoDB\u8fd8\u5bf9OS\u81ea\u5e26\u7684\u5185\u5b58\u5206\u914d\u7ba1\u7406\uff08malloc\u548cfree\uff09\u4f5c\u4e86\u4e00\u6b21\u7b80\u5355\u5c01\u88c5\uff0c\u8fd9\u4e9b\u7ba1\u7406\u51fd\u6570\u5b9e\u73b0\u4e5f\u7c7b\u4f3c\u5730\u901a\u8fc7\u4e92\u65a5\u91cf\u7684\u673a\u5236\u5b9e\u73b0\u7684\uff0c\u6240\u4ee5\u8fd9\u5e76\u6ca1\u6709\u89e3\u51b3\u95ee\u9898\u3002\u73b0\u5728\u591a\u6838CPU\u5230\u5904\u90fd\u662f\uff08\u4e2a\u4ebaPC\u90fd\u662f\uff09\uff0c\u73b0\u5728\u4e5f\u6709\u4e86\u65b0\u7684\u5185\u5b58\u5206\u914d\u5668\uff0c\u5927\u5927\u63d0\u5347\u4e86\u5bf9\u591a\u6838CPU\u7684\u652f\u6301\u3002\u4f8b\u5982\uff1a Hoard, libumem, mtmalloc, ptmalloc, tbbmalloc, and TCMalloc\u7b49\u7b49\uff0c\u5982\u679c\u4f60\u7684\u5e94\u7528\u6709\u5927\u91cf\u7684\u5185\u5b58\u5206\u914d\u548c\u91ca\u653e\u64cd\u4f5c\uff0c\u4f7f\u7528\u8fd9\u4e9b\u5185\u5b58\u5206\u914d\u5668\u5c06\u5bf9\u6027\u80fd\u6709\u5f88\u5927\u7684\u63d0\u5347\u3002<\/p>\n<p>\u53ef\u4ee5\u901a\u8fc7\u53c2\u6570<a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.1\/en\/innodb-parameters.html#sysvar_innodb_use_sys_malloc\">innodb_use_sys_malloc<\/a>\u6765\u63a7\u5236InnoDB_Plugin\u662f\u5426\u4f7f\u7528\u7cfb\u7edf\u7684\u5185\u5b58\u5206\u914d\u5668\u3002<a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.1\/en\/innodb-parameters.html#sysvar_innodb_use_sys_malloc\">innodb_use_sys_malloc<\/a>\u8bbe\u7f6e\u62100\uff0cInnoDB\u5c06\u4f7f\u7528\u81ea\u5df1\u5b9e\u73b0\u7684\u5185\u5b58\u7ba1\u7406\u529f\u80fd\uff1b\u8bbe\u7f6e\u4e3aON\u65f6\uff08\u9ed8\u8ba4\u8bbe\u7f6e\uff09\uff0c\u5219\u4f7f\u7528\u7cfb\u7edf\u7684\u5185\u5b58\u5206\u914d\u5668\u3002\u8fd9\u65f6\u5982\u679c\u7cfb\u7edf\u4e2d\u5b89\u88c5\u4e86\u65b0\u7684\u5185\u5b58\u5206\u914d\u5668\uff08\u5982TCMalloc\uff09\uff0c\u53ea\u9700\u5728\u542f\u52a8MySQL\u65f6\uff0c\u8bbe\u5b9a\u73af\u5883\u53d8\u91cfLD_PRELOAD\u548cLD_LIBRARY_PATH\u6307\u5411\u65b0\u5206\u914d\u7684\u52a8\u6001\u8fde\u63a5\u5e93\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8feb\u4e8e\u5f00\u6e90\u793e\u533a\u3001\u56e2\u4f53\uff08Google Facebook Percona Xaprb\u7b49\uff09\u7684\u5de8\u5927\u538b\u529b\uff0cInnoDB Plugin\u76f8\u6bd4Built-in\u7248\u672c\u6709\u4e86\u5f88\u5927\u7684\u63d0\u5347\uff0c\u8fd9\u4e9b\u63d0\u5347\u591a\u6570\u6765\u81ea\u5f00\u6e90\u793e\u533a\u8d21\u732e\u7684\u4ee3\u7801\uff0c\u867d\u7136\u672c\u8eab\u4e5f\u6709\u4e00\u4e9b\u6539\u8fdb\u3002 1. \u5173\u4e8eFast locking \u5728\u591a\u4e2a\u7ebf\u7a0b\u5e76\u53d1\u8bbf\u95ee\u76f8\u540c\u8d44\u6e90\u7684\u65f6\u5019\uff0c\u9700\u8981\u4f7f\u7528\u4e00\u4e9bInnoDB\u5b9e\u73b0\u7684\u4e92\u65a5\u91cf\uff08mutex\uff09\u548c\u8bfb\u5199\u9501\uff08read\/write lock\uff09\u3002\u5728Unix-like\u5e73\u53f0\u4e0a\uff0cInnoDB\u662f\u901a\u8fc7Pthread\u7684\u4e92\u65a5\u91cf\uff08\u8fd9\u662fPOSIX\u6807\u51c6\u7684\u4e00\u90e8\u5206\uff09\u6765\u5b9e\u73b0\u7684\u3002\u5728\u73b0\u4ee3OS\u548c\u786c\u4ef6\u5e73\u53f0\u4e2d\uff0c\u4e00\u822c\u90fd\u6709\u4e86\u66f4\u6709\u6548\u7684\u66ff\u4ee3\u65b9\u6848\uff0c\u591a\u6570\u60c5\u51b5\u4e0b\u8fd9\u4e9b\u66ff\u4ee3\u65b9\u6848\u4f7f\u7528\u66f4\u5c11\u7684CPU\u6307\u4ee4\u548c\u65f6\u949f\u5468\u671f\u6765\u5b8c\u6210\u8fd9\u4e9b\u4e92\u65a5\u5904\u7406\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","inline_featured_image":false,"_tocer_settings":[],"footnotes":""},"categories":[6],"tags":[120,52,118],"class_list":["post-1680","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-innodb","tag-innodb-plugin","tag-mysql"],"_links":{"self":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/1680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/comments?post=1680"}],"version-history":[{"count":11,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/1680\/revisions"}],"predecessor-version":[{"id":1728,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/1680\/revisions\/1728"}],"wp:attachment":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/media?parent=1680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/categories?post=1680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/tags?post=1680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}