{"id":1423,"date":"2015-01-30T10:03:24","date_gmt":"2015-01-30T02:03:24","guid":{"rendered":"https:\/\/cowmanchiang.me\/wp\/?p=1423"},"modified":"2023-10-31T15:43:50","modified_gmt":"2023-10-31T07:43:50","slug":"%e5%90%8d%e8%a9%9e%e8%a7%a3%e9%87%8b","status":"publish","type":"post","link":"https:\/\/cowmanchiang.me\/wp\/?p=1423","title":{"rendered":"ACID &#038; CAP"},"content":{"rendered":"<ul>\n<li>ACID: \u8cc7\u6599\u5eab\u7ba1\u7406\u7cfb\u7d71(DBMS)\u5728\u5beb\u5165\/\u7570\u52d5\u8cc7\u6599\u7684\u904e\u7a0b\u4e2d\uff0c\u70ba\u4fdd\u8b49\u4ea4\u6613(transaction)\u662f\u6b63\u78ba\u53ef\u9760\u7684\uff0c\u6240\u5fc5\u9808\u5177\u5099\u7684\u56db\u500b\u7279\u6027\uff1a\u539f\u5b50\u6027(atomicity\uff0c\u6216\u7a31\u4e0d\u53ef\u5206\u5272\u6027)\u3001\u4e00\u81f4\u6027(consistency)\u3001\u9694\u96e2\u6027(isolation\uff0c\u53c8\u7a31\u7368\u7acb\u6027)\u3001\u6301\u4e45\u6027(durability)\u3002 &#8230;.. <a href=\"http:\/\/zh.wikipedia.org\/wiki\/ACID\">source: Wiki &#8211; ACID<\/a>\n<ul>\n<li>Atomicity(\u539f\u5b50\u6027)<br \/>\n\u4e00\u500b\u4ea4\u6613(transaction)\u4e2d\u7684\u6240\u6709\u64cd\u4f5c\uff0c\u8981\u9ebc\u5168\u90e8\u5b8c\u6210\uff0c\u8981\u9ebc\u5168\u90e8\u4e0d\u5b8c\u6210\uff0c\u4e0d\u6703\u7d50\u675f\u5728\u4e2d\u9593\u67d0\u500b\u74b0\u7bc0\u3002\u4e8b\u52d9\u5728\u57f7\u884c\u904e\u7a0b\u4e2d\u767c\u751f\u932f\u8aa4\uff0c\u6703\u88ab\u56de\u6efe(Rollback)\u5230\u4e8b\u52d9\u958b\u59cb\u524d\u7684\u72c0\u614b\uff0c\u5c31\u50cf\u9019\u500b\u4e8b\u52d9\u5f9e\u4f86\u6c92\u6709\u57f7\u884c\u904e\u4e00\u6a23\u3002<\/li>\n<li>Consistency(\u4e00\u81f4\u6027) \u5728\u4e8b\u52d9\u958b\u59cb\u4e4b\u524d\u548c\u4e8b\u52d9\u7d50\u675f\u4ee5\u5f8c\uff0c\u8cc7\u6599\u5eab\u7684\u5b8c\u6574\u6027\u6c92\u6709\u88ab\u7834\u58de\u3002\u9019\u8868\u793a\u5beb\u5165\u7684\u8cc7\u6599\u5fc5\u9808\u5b8c\u5168\u7b26\u5408\u6240\u6709\u7684\u9810\u8a2d\u898f\u5247\uff0c\u9019\u5305\u542b\u8cc7\u6599\u7684\u7cbe\u78ba\u5ea6\u3001\u4e32\u806f\u6027\u4ee5\u53ca\u5f8c\u7e8c\u8cc7\u6599\u5eab\u53ef\u4ee5\u81ea \u767c\u6027\u5730\u5b8c\u6210\u9810\u5b9a\u7684\u5de5\u4f5c\u3002<\/li>\n<li>Isolation(\u9694\u96e2\u6027)<br \/>\n\u7576\u5169\u500b\u6216\u8005\u591a\u500b\u4e8b\u52d9\u4e26\u767c\u8a2a\u554f\uff08\u6b64\u8655\u8a2a\u554f\u6307\u67e5\u8a62\u548c\u4fee\u6539\u7684\u64cd\u4f5c\uff09\u8cc7\u6599\u5eab\u7684\u540c\u4e00\u6578\u64da\u6642\u6240\u8868\u73fe\u51fa\u7684\u76f8\u4e92\u95dc\u4fc2\u3002\u4e8b\u52d9\u9694\u96e2\u5206\u70ba\u4e0d\u540c\u7d1a\u5225\uff0c\u5305\u62ec\u8b80\u672a\u63d0\u4ea4(Read uncommitted)\u3001\u8b80\u63d0\u4ea4(read committed)\u3001\u53ef\u91cd\u8907\u8b80(repeatable read)\u548c\u4e32\u5217\u5316(Serializable)\u3002<\/li>\n<li>Durability(\u6301\u4e45\u6027) \u5728\u4e8b\u52d9\u5b8c\u6210\u4ee5\u5f8c\uff0c\u8a72\u4e8b\u52d9\u5c0d\u8cc7\u6599\u5eab\u6240\u4f5c\u7684\u66f4\u6539\u4fbf\u6301\u4e45\u5730\u4fdd\u5b58\u5728\u8cc7\u6599\u5eab\u4e4b\u4e2d\uff0c\u4e26\u4e14\u662f\u5b8c\u5168\u7684\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<ul>\n<li>CAP: \u53c8\u88ab\u7a31\u4f5c\u5e03\u9b6f\u723e\u5b9a\u7406(Brewer&#8217;s theorem)\uff0c\u5b83\u6307\u51fa\u5c0d\u65bc\u4e00\u500b\u5206\u5e03\u5f0f\u8a08\u7b97\u7cfb\u7d71\u4f86\u8aaa\uff0c\u4e0d\u53ef\u80fd\u540c\u6642\u6eff\u8db3\u4ee5\u4e0b\u4e09\u9ede\uff1a\u4e00\u81f4\u6027(Consistency)\u3001\u53ef\u7528\u6027(Availability)\u3001\u5bb9\u5fcd\u7db2\u8def\u5206\u5340(Partition tolerance)\uff1b\u6839\u64da\u5b9a\u7406\uff0c\u5206\u4f48\u5f0f\u7cfb\u7d71\u53ea\u80fd\u6eff\u8db3\u4e09\u9805\u4e2d\u7684\u5169\u9805\u800c\u4e0d\u53ef\u80fd\u6eff\u8db3\u5168\u90e8\u4e09\u9805\u3002 &#8230;.. <a href=\"http:\/\/zh.wikipedia.org\/wiki\/CAP\">source: Wiki &#8211; CAP\u5b9a\u88e1<\/a>\n<ul>\n<li>Consistency(\u4e00\u81f4\u6027): \u7b49\u540c\u65bc\u6240\u6709\u7bc0\u9ede\u8a2a\u554f\u540c\u4e00\u4efd\u6700\u65b0\u7684\u6578\u64da\u526f\u672c<\/li>\n<li>Availability(\u53ef\u7528\u6027): \u5c0d\u6578\u64da\u66f4\u65b0\u5177\u5099\u9ad8\u53ef\u7528\u6027<\/li>\n<li>Partition tolerance(\u5bb9\u5fcd\u7db2\u8def\u5206\u5340): \u4ee5\u5be6\u969b\u6548\u679c\u800c\u8a00\uff0c\u5206\u5340\u76f8\u7576\u65bc\u5c0d\u901a\u4fe1\u7684\u6642\u9650\u8981\u6c42\u3002\u7cfb\u7d71\u5982\u679c\u4e0d\u80fd\u5728\u6642\u9650\u5167\u9054\u6210\u6578\u64da\u4e00\u81f4\u6027\uff0c\u5c31\u610f\u5473\u8457\u767c\u751f\u4e86\u5206\u5340\u7684\u60c5\u6cc1\uff0c\u5fc5\u9808\u5c31\u7576\u524d\u64cd\u4f5c\u5728C\u548cA\u4e4b\u9593\u505a\u51fa\u9078\u64c7\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>ACID: \u8cc7\u6599\u5eab\u7ba1\u7406\u7cfb\u7d71(DBMS)\u5728\u5beb\u5165\/\u7570\u52d5\u8cc7\u6599\u7684\u904e\u7a0b\u4e2d\uff0c\u70ba\u4fdd\u8b49\u4ea4\u6613(transaction)\u662f\u6b63\u78ba\u53ef\u9760\u7684\uff0c\u6240\u5fc5\u9808\u5177\u5099\u7684\u56db\u500b\u7279\u6027\uff1a\u539f\u5b50\u6027(atomicity\uff0c\u6216\u7a31\u4e0d\u53ef\u5206\u5272\u6027)\u3001\u4e00\u81f4\u6027(consistency)\u3001\u9694\u96e2\u6027(isolation\uff0c\u53c8\u7a31\u7368\u7acb\u6027)\u3001\u6301\u4e45\u6027(durability)\u3002 &#8230;.. source: Wiki &#8211; ACID Atomicity(\u539f\u5b50\u6027) \u4e00\u500b\u4ea4\u6613(transaction)\u4e2d\u7684\u6240\u6709\u64cd\u4f5c\uff0c\u8981\u9ebc\u5168\u90e8\u5b8c\u6210\uff0c\u8981\u9ebc\u5168\u90e8\u4e0d\u5b8c\u6210\uff0c\u4e0d\u6703\u7d50\u675f\u5728\u4e2d\u9593\u67d0\u500b\u74b0\u7bc0\u3002\u4e8b\u52d9\u5728\u57f7\u884c\u904e\u7a0b\u4e2d\u767c\u751f\u932f\u8aa4\uff0c\u6703\u88ab\u56de\u6efe(Rollback)\u5230\u4e8b\u52d9\u958b\u59cb\u524d\u7684\u72c0\u614b\uff0c\u5c31\u50cf\u9019\u500b\u4e8b\u52d9\u5f9e\u4f86\u6c92\u6709\u57f7\u884c\u904e\u4e00\u6a23\u3002 Consistency(\u4e00\u81f4\u6027) \u5728\u4e8b\u52d9\u958b\u59cb\u4e4b\u524d\u548c\u4e8b\u52d9\u7d50\u675f\u4ee5\u5f8c\uff0c\u8cc7\u6599\u5eab\u7684\u5b8c\u6574\u6027\u6c92\u6709\u88ab\u7834\u58de\u3002\u9019\u8868\u793a\u5beb\u5165\u7684\u8cc7\u6599\u5fc5\u9808\u5b8c\u5168\u7b26\u5408\u6240\u6709\u7684\u9810\u8a2d\u898f\u5247\uff0c\u9019\u5305\u542b\u8cc7\u6599\u7684\u7cbe\u78ba\u5ea6\u3001\u4e32\u806f\u6027\u4ee5\u53ca\u5f8c\u7e8c\u8cc7\u6599\u5eab\u53ef\u4ee5\u81ea \u767c\u6027\u5730\u5b8c\u6210\u9810\u5b9a\u7684\u5de5\u4f5c\u3002 Isolation(\u9694\u96e2\u6027) \u7576\u5169\u500b\u6216\u8005\u591a\u500b\u4e8b\u52d9\u4e26\u767c\u8a2a\u554f\uff08\u6b64\u8655\u8a2a\u554f\u6307\u67e5\u8a62\u548c\u4fee\u6539\u7684\u64cd\u4f5c\uff09\u8cc7\u6599\u5eab\u7684\u540c\u4e00\u6578\u64da\u6642\u6240\u8868\u73fe\u51fa\u7684\u76f8\u4e92\u95dc\u4fc2\u3002\u4e8b\u52d9\u9694\u96e2\u5206\u70ba\u4e0d\u540c\u7d1a\u5225\uff0c\u5305\u62ec\u8b80\u672a\u63d0\u4ea4(Read uncommitted)\u3001\u8b80\u63d0\u4ea4(read committed)\u3001\u53ef\u91cd\u8907\u8b80(repeatable read)\u548c\u4e32\u5217\u5316(Serializable)\u3002 Durability(\u6301\u4e45\u6027) \u5728\u4e8b\u52d9\u5b8c\u6210\u4ee5\u5f8c\uff0c\u8a72\u4e8b\u52d9\u5c0d\u8cc7\u6599\u5eab\u6240\u4f5c\u7684\u66f4\u6539\u4fbf\u6301\u4e45\u5730\u4fdd\u5b58\u5728\u8cc7\u6599\u5eab\u4e4b\u4e2d\uff0c\u4e26\u4e14\u662f\u5b8c\u5168\u7684\u3002 CAP: \u53c8\u88ab\u7a31\u4f5c\u5e03\u9b6f\u723e\u5b9a\u7406(Brewer&#8217;s theorem)\uff0c\u5b83\u6307\u51fa\u5c0d\u65bc\u4e00\u500b\u5206\u5e03\u5f0f\u8a08\u7b97\u7cfb\u7d71\u4f86\u8aaa\uff0c\u4e0d\u53ef\u80fd\u540c\u6642\u6eff\u8db3\u4ee5\u4e0b\u4e09\u9ede\uff1a\u4e00\u81f4\u6027(Consistency)\u3001\u53ef\u7528\u6027(Availability)\u3001\u5bb9\u5fcd\u7db2\u8def\u5206\u5340(Partition tolerance)\uff1b\u6839\u64da\u5b9a\u7406\uff0c\u5206\u4f48\u5f0f\u7cfb\u7d71\u53ea\u80fd\u6eff\u8db3\u4e09\u9805\u4e2d\u7684\u5169\u9805\u800c\u4e0d\u53ef\u80fd\u6eff\u8db3\u5168\u90e8\u4e09\u9805\u3002 &#8230;.. source: Wiki &#8211; CAP\u5b9a\u88e1 Consistency(\u4e00\u81f4\u6027): \u7b49\u540c\u65bc\u6240\u6709\u7bc0\u9ede\u8a2a\u554f\u540c\u4e00\u4efd\u6700\u65b0\u7684\u6578\u64da\u526f\u672c Availability(\u53ef\u7528\u6027): \u5c0d\u6578\u64da\u66f4\u65b0\u5177\u5099\u9ad8\u53ef\u7528\u6027 Partition tolerance(\u5bb9\u5fcd\u7db2\u8def\u5206\u5340): \u4ee5\u5be6\u969b\u6548\u679c\u800c\u8a00\uff0c\u5206\u5340\u76f8\u7576\u65bc\u5c0d\u901a\u4fe1\u7684\u6642\u9650\u8981\u6c42\u3002\u7cfb\u7d71\u5982\u679c\u4e0d\u80fd\u5728\u6642\u9650\u5167\u9054\u6210\u6578\u64da\u4e00\u81f4\u6027\uff0c\u5c31\u610f\u5473\u8457\u767c\u751f\u4e86\u5206\u5340\u7684\u60c5\u6cc1\uff0c\u5fc5\u9808\u5c31\u7576\u524d\u64cd\u4f5c\u5728C\u548cA\u4e4b\u9593\u505a\u51fa\u9078\u64c7\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-1423","post","type-post","status-publish","format-standard","hentry","category-18"],"_links":{"self":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1423","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1423"}],"version-history":[{"count":1,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1423\/revisions"}],"predecessor-version":[{"id":1936,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1423\/revisions\/1936"}],"wp:attachment":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}