{"id":1683,"date":"2018-05-14T01:37:30","date_gmt":"2018-05-13T17:37:30","guid":{"rendered":"http:\/\/www.brofive.org\/?p=1683"},"modified":"2018-05-14T01:41:57","modified_gmt":"2018-05-13T17:41:57","slug":"foundationdb%ef%bc%9a%e6%94%af%e6%8c%81%e4%ba%8b%e5%8a%a1%e7%9a%84nosql%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"http:\/\/www.brofive.net\/?p=1683","title":{"rendered":"FoundationDB\uff1a\u652f\u6301\u4e8b\u52a1\u7684NoSQL\u6570\u636e\u5e93"},"content":{"rendered":"<p><a href=\"http:\/\/www.brofive.net\/wp-content\/uploads\/2018\/05\/clip_image001.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border: 0px;\" title=\"clip_image001\" src=\"http:\/\/www.brofive.net\/wp-content\/uploads\/2018\/05\/clip_image001_thumb.jpg\" alt=\"clip_image001\" width=\"584\" height=\"311\" border=\"0\" \/><\/a><\/p>\n<p>FoundationDB2012\u5e74\u53d1\u5e03\u4e86Alpha\u7248\u672c\uff0c2013\u5e74\u53d1\u5e03Beta\u7248\u672c\uff0c<a href=\"https:\/\/techcrunch.com\/2015\/03\/24\/apple-acquires-durable-database-company-foundationdb\/\">2015\u5e74\u88ab\u82f9\u679c\u6536\u8d2d<\/a>\u3002\u636e\u8bf4\u6700\u65e9\u662f\u5f00\u6e90\u6570\u636e\u5e93\uff0c\u540e\u6765\u88ab\u82f9\u679c\u6536\u8d2d\u95ed\u6e90\u4e86\uff0c2018\u5e744\u670819\u65e5\uff0c\u82f9\u679c\u6b63\u5f0f\u53d1\u5e035.1.7\u7248\u672c\uff0c\u5e76\u5ba3\u5e03FDB\u5f00\u6e90\uff08https:\/\/apple.github.io\/foundationdb\/\uff09\u3002<\/p>\n<p>\u4e00\u3001FDB\u7684\u4f53\u7cfb\u67b6\u6784\uff1a<\/p>\n<p><a href=\"http:\/\/www.brofive.net\/wp-content\/uploads\/2018\/05\/clip_image002.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border: 0px;\" title=\"clip_image002\" src=\"http:\/\/www.brofive.net\/wp-content\/uploads\/2018\/05\/clip_image002_thumb.png\" alt=\"clip_image002\" width=\"822\" height=\"700\" border=\"0\" \/><\/a><\/p>\n<p>FDB\u662f\u4e00\u4e2a\u652f\u6301\u4e8b\u52a1\u7684\u591a\u6a21\u578b\u6838\u5fc3KVStore\u3002\u6838\u5fc3\u7684\u610f\u601d\u662f\uff0cFDB\u4ec5\u652f\u6301\u6700\u91cd\u8981\u7684\u7279\u6027\u7684API\u3002FDB\u7f51\u7ad9\u5f88\u503c\u5f97\u5b66\u4e60\uff0c\u4e0d\u4ec5\u4ec5\u4ecb\u7ecd\u4e86\u81ea\u5df1\u7684\u4ea7\u54c1FDB\uff0c\u8fd8\u4ecb\u7ecd\u4e86\u8bbe\u8ba1\u601d\u8def\u3002\u4e0d\u8fc7FDB\u7684\u8bbe\u8ba1\u5e76\u6ca1\u6709\u4ec0\u4e48\u7279\u522b\u7684\u5730\u65b9\uff0c\u57fa\u672c\u4e0a\u67095\u4e2a\u90e8\u5206\uff1a<\/p>\n<p>1\u3001\u5b58\u50a8\u8282\u70b9\u96c6\u7fa4\u3002\u53ea\u89e3\u51b3\u6570\u636e\u5b58\u50a8\u7684\u53ef\u9760\u6027\u95ee\u9898\uff0c\u9488\u5bf9SSD\u4f18\u5316\uff0c\u5bf9HDD\u4f9d\u7136\u652f\u6301\uff0c\u4f46\u6ca1\u6709\u7279\u522b\u4f18\u5316<\/p>\n<p>2\u3001\u534f\u8c03\u96c6\u7fa4\u3002\u4f7f\u7528PAXOS\u7b97\u6cd5\u9009\u4e3b\u96c6\u7fa4\uff0c\u4e0d\u4ecb\u5165\u4e8b\u52a1\u5904\u7406\uff08\u4e3a1\u548c3\u670d\u52a1\uff09<\/p>\n<p>3\u3001\u4e8b\u52a1\u7ba1\u7406\u96c6\u7fa4\u3002\u7528\u6765\u652f\u6301ACID\u4e8b\u52a1\u3002<\/p>\n<p>4\u3001\u5c42\u548c\u5ba2\u6237\u7aef\u3002\u5c42\u662f\u7528\u6765\u652f\u6301\u591a\u6a21\u578b\u7684\uff0c\u867d\u7136\u5e94\u7528\u53ef\u4ee5\u76f4\u63a5\u8bbf\u95ee\u6838\u5fc3\u5c42\uff0c\u4f46\u662f\u901a\u8fc7\u5c42\u53ef\u4ee5\u5c01\u88c5\u66f4\u7b80\u5355\u7684API\u548c\u66f4\u590d\u6742\u7684\u903b\u8f91\u3002\u8fd9\u4e2a\u90e8\u5206\u7528\u6765\u5b8c\u6210\u6570\u636e\u4ea4\u4e92\uff0c\u57fa\u672c\u7b56\u7565\u662f\uff0c\u5e94\u7528\u9700\u8981\u4e86\u89e3\u81ea\u5df1\u6570\u636e\u5b9e\u9645\u4e0a\u662f\u5206\u7247\u7684\uff0c\u8981\u6709\u4e00\u4e9b\u9488\u5bf9FDB\u7684\u4f18\u5316\u8bbe\u8ba1\u3002\u4ece\u67d0\u79cd\u610f\u4e49\u4e0a\u770b\uff0cNoSQL\u8fd0\u52a8\u7684\u4e00\u4e2a\u91cd\u8981\u4f5c\u7528\u5728\u4e8e\u6253\u5f00\u4e86RDBMS\u8fd9\u4e2a\u9ed1\u76d2\u5b50\uff0c\u628a\u5b58\u50a8\u5f15\u64ce\u3001\u7ba1\u7406\u548c\u4ef2\u88c1\u3001\u67e5\u8be2\u5f15\u64ce\u4e09\u4e2a\u90e8\u5206\u89e3\u8026\u4e86\u3002\u6b64\u5916NoSQL\u8fd8\u5e26\u52a8\u4e86\u5206\u5e03\u5f0f\u6570\u636e\u5e93\u7684\u53d1\u5c55\u3002<\/p>\n<p>2.1 FDB\u7684\u8bbe\u8ba1\u9650\u5236\uff1a<\/p>\n<p>1\u3001\u4e00\u4e2a\u4e8b\u52a1\u4e0d\u80fd\u8d85\u8fc710,000,000\u5b57\u8282\uff0c\u7ea610MB\u6570\u636e\uff08\u5168\u90e8\u5305\u62ec\uff09\u3010\u6709\u65b9\u6848\u3011<\/p>\n<p>2\u3001Key\u4e0d\u80fd\u5927\u4e8e10000\u5b57\u8282\uff0c\u7ea610KB\u6570\u636e\uff1bValue\u4e0d\u80fd\u8d85\u8fc7100,000\u5b57\u8282\uff0c\u7ea6100KB\u3010\u6709\u65b9\u6848\u3011<\/p>\n<p>3\u3001\u4e0d\u652f\u6301\u7ec6\u7c92\u5ea6\u7684\u6743\u9650\u63a7\u5236\uff0c\u7528\u6237\u53ef\u4ee5\u8bbf\u95ee\u5168\u90e8\u6570\u636e<\/p>\n<p>4\u3001\u533a\u6bb5\u626b\u63cf\u901f\u5ea6\u6162\u3010\u6709\u65b9\u6848\u3011<\/p>\n<p>2.2 FDB 5.1 \u76ee\u524d\u5c1a\u672a\u5b9e\u73b0\u7684\u80fd\u529b\uff1a<\/p>\n<p>1\u3001\u4e00\u4e2a\u4e8b\u52a1\u5fc5\u987b\u57285\u79d2\u5185\u7ed3\u675f\uff0c\u5426\u5219\u629b\u51fa\u5f02\u5e38\uff08transaction_too_old \u6216\u8005 not_committed\uff09\uff0c\u4e00\u822c\u4e8b\u52a115ms\u3010\u6709\u65b9\u6848\u3011<\/p>\n<p>2\u3001\u96c6\u7fa4\u89c4\u6a21\u5728\u8d85\u8fc7500\u4e2acore\/process\u4e4b\u540e\uff0c\u6027\u80fd\u4e0d\u80fd\u7ebf\u6027\u589e\u957f\uff0820\u53f0\u5de6\u53f32\u8def16\u6838\u7684\u670d\u52a1\u5668\uff09<\/p>\n<p>3\u3001\u6570\u636e\u5e93\u5728100TB\u4ee5\u4e0a\u540e\uff0c\u6570\u636e\u590d\u5236\u4f1a\u9020\u6210\u78c1\u76d8\u5bb9\u91cf\u663e\u8457\u589e\u957f\uff0c\u4ee5\u53ca\u989d\u5916\u5f00\u9500\u3002<\/p>\n<p>4\u3001\u7531\u4e8e\u5c1a\u672a\u5bf9\u70ed\u70b9\u6570\u636e\u505a\u591a\u526f\u672c\uff0c\u56e0\u6b64\u96c6\u7fa4\u9488\u5bf9\u67d0\u4e2aKey\u7684\u8bfb\u6027\u80fd\u4e0d\u4f1a\u8d85\u8fc73\u4e2a\u8282\u70b9\uff08\u6216\u8005\u8fdb\u7a0b\uff09\uff0c\u901a\u5e38\u662f10\u4e07RPS\u91cf\u7ea7\u3010\u6709\u65b9\u6848\u3011<\/p>\n<p>\u4e8c\u3001<a href=\"https:\/\/apple.github.io\/foundationdb\/data-modeling.html\">FDB\u6570\u636e\u6a21\u578b<\/a>\uff1a<\/p>\n<p>1\u3001FDB\u7684\u6570\u636e\u6a21\u578b\u662f\u975e\u5e38\u7b80\u5355\u7684\uff0c\u4e3b\u8981\u6d89\u53ca\u5230\u6838\u5fc3\u7684\u6392\u5e8fKV\u6a21\u578b\uff0cFDB\u4e2d\u6bcf\u4e2a\u6570\u636e\u90fd\u662f\u6309\u7167Byte String\u6392\u5e8f\u7684\uff0c\u56e0\u6b64\u6574\u6570\u3001\u6d6e\u70b9\u6570\u3001\u591a\u5b57\u8282\u6570\u636e\u90fd\u662f\u9700\u8981\u5e8f\u5217\u5316\u4e4b\u540e\u624d\u80fd\u4fdd\u6301\u6709\u5e8f\uff0c\u8fd9\u4e2a\u4efb\u52a1\u4ea4\u7ed9\u4e86\u5e94\u7528\u7cfb\u7edf\u3002\u4efb\u6027\uff01\uff01<\/p>\n<p>2\u3001FDB\u7684\u7075\u6d3b\u6027\u6765\u81ea<a href=\"https:\/\/apple.github.io\/foundationdb\/api-python.html#api-python-tuple-layer\">Tuple<\/a>\u8fd9\u4e2a\u6570\u636e\u6a21\u578b\uff0c\u8fd9\u4e2a\u6a21\u578b\u53ef\u4ee5\u6784\u6210\u5f88\u591a\u4e2a\u5b57\u6bb5\u6784\u6210\u7684\u5143\u7ec4\uff0c\u800c\u4e14\u8fd9\u4e9b\u5143\u7ec4\u4e5f\u662f\u4f9d\u6b21\u6709\u5e8f\u7684\uff0c\u8fd9\u4e00\u70b9\u4e3a\u590d\u6742\u6570\u636e\u6a21\u578b\u8bbe\u8ba1\u63d0\u4f9b\u4e86\u57fa\u7840\uff0c\u5305\u62ecMap\u3001Array\u3001MultiMap\u3001Table\u3001ER\u6a21\u578b\u3001Index\u3001\u4f53\u7cfb\u5316\u6570\u636e\u3001\u6587\u6863\u3001\u94fe\u8868\u3002\u4ed4\u7ec6\u7814\u7a76\u4e86Index\u3001Table\u90e8\u5206\uff0c\u7acb\u523b\u5c31\u660e\u767d\u4e86\u4ee5\u524d\u770b\u5230\u7684AWS SimpleDB\u7684\u4e00\u4e2a\u8bbe\u8ba1\u95ee\u9898\uff1a\u7d22\u5f15\u592a\u591a\u95ee\u9898\u9020\u6210\u6570\u636e\u81a8\u80c0\u3002\u8fd9\u4e2a\u95ee\u9898\u5b9e\u9645\u4e0a\u662f\u65e9\u671f\u5e94\u7528\u89c4\u5212\u4e0d\u5584\uff0c\u6700\u540e\u9020\u6210\u6bcf\u4e2a\u5217\u90fd\u8981\u5efa\u7acb\u7d22\u5f15\u9020\u6210\u7684\u95ee\u9898\u3002\u5e76\u4e0d\u4ec5\u4ec5\u662fNoSQL\u7684\u95ee\u9898\uff0cSQL\u9886\u57df\u66f4\u4e3a\u4e25\u91cd\uff0c\u800c\u4e14\u65e0\u6cd5\u89e3\u51b3\u3002<\/p>\n<p>3\u3001Key\u7684\u8bbe\u8ba1\u6ca1\u6709\u66f4\u591a\u7684\u65b0\u82b1\u6837\uff0c\u53ea\u8981\u77e5\u9053HBase\u600e\u4e48\u8bbe\u8ba1Key\uff0c\u5728FDB\u4e2d\u4f9d\u7136\u53ef\u7528\uff0c\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff1a\uff081\uff09Key\u7684\u7ed3\u6784\u5316\u5f88\u91cd\u8981\uff0c\u53ef\u4ee5\u6d88\u9664\u65e0\u6548\u67e5\u627e\uff082\uff09\u7f29\u5c0fKey\u7684\u8303\u56f4\uff0c\u907f\u514d\u4e00\u4e2aKey\u6620\u5c04\u5230\u592a\u591a\u6570\u636e\uff083\uff09Key\u8981\u5c0f\uff0c32\u5b57\u8282\u6700\u597d\uff0c\u5c0f\u4e8e1KB\uff0c\u4e0d\u80fd\u8d85\u8fc710KB\uff084\uff09Value\u5c0f\u4e8e10KB\uff08\u6700\u5927100KB\uff09\u2026 \u770b\u6765\u4e0d\u80fd\u7528\u4e8e\u5b58\u50a8\u56fe\u50cf\u4e86\u3010<a href=\"https:\/\/apple.github.io\/foundationdb\/tutorials.html\">https:\/\/apple.github.io\/foundationdb\/tutorials.html<\/a>\u3011<\/p>\n<p>\u4e09\u3001FDB\u7684\u5e94\u7528\uff1a\u652f\u6301Java\u3001Python\u3001Ruby\u3001Go\u3001C 5\u79cd\u8bed\u8a00<\/p>\n<p>\u81ea\u5e26\u7684\u4f8b\u5b50\uff0c\u53ef\u4ee5\u8dd1\u7684\u901a\uff0cJDK8<\/p>\n<p><em>import com.apple.foundationdb.Database;<br \/>\nimport com.apple.foundationdb.FDB;<br \/>\nimport com.apple.foundationdb.tuple.Tuple;<\/em><\/p>\n<p><em>public class Example {<br \/>\npublic static void main(String[] args) {<br \/>\nFDB fdb = FDB.selectAPIVersion(510);<\/em><\/p>\n<p><em>try(Database db = fdb.open()) {<br \/>\n\/\/ Run an operation on the database<br \/>\ndb.run(tr -&gt; {<br \/>\ntr.set(Tuple.from(&#8220;hello&#8221;).pack(), Tuple.from(&#8220;world&#8221;).pack());<br \/>\nreturn null;<br \/>\n});<\/em><\/p>\n<p><em>\/\/ Get the value of &#8216;hello&#8217; from the database<br \/>\nString hello = db.run(tr -&gt; {<br \/>\nbyte[] result = tr.get(Tuple.from(&#8220;hello&#8221;).pack()).join();<br \/>\nreturn Tuple.fromBytes(result).getString(0);<br \/>\n});<\/em><\/p>\n<p><em>System.out.println(&#8220;Hello &#8221; + hello);<br \/>\n}<br \/>\n}<br \/>\n}<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>\u76f8\u5173\u4fe1\u606f\uff1a<\/p>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/FoundationDB\">https:\/\/en.wikipedia.org\/wiki\/FoundationDB<\/a><\/p>\n<p><a href=\"https:\/\/apple.github.io\/foundationdb\/\">https:\/\/apple.github.io\/foundationdb\/<\/a><\/p>\n<p><a href=\"https:\/\/apple.github.io\/foundationdb\/technical-overview.html\">https:\/\/apple.github.io\/foundationdb\/technical-overview.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>FoundationDB2012\u5e74\u53d1\u5e03\u4e86Alpha\u7248\u672c\uff0c2013\u5e74\u53d1\u5e03Beta\u7248\u672c\uff0c2015\u5e74\u88ab\u82f9\u679c\u6536\u8d2d\u3002\u636e\u8bf4&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1680,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,119,20],"tags":[358,357],"views":5466,"_links":{"self":[{"href":"http:\/\/www.brofive.net\/index.php?rest_route=\/wp\/v2\/posts\/1683"}],"collection":[{"href":"http:\/\/www.brofive.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.brofive.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.brofive.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.brofive.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1683"}],"version-history":[{"count":2,"href":"http:\/\/www.brofive.net\/index.php?rest_route=\/wp\/v2\/posts\/1683\/revisions"}],"predecessor-version":[{"id":1689,"href":"http:\/\/www.brofive.net\/index.php?rest_route=\/wp\/v2\/posts\/1683\/revisions\/1689"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.brofive.net\/index.php?rest_route=\/wp\/v2\/media\/1680"}],"wp:attachment":[{"href":"http:\/\/www.brofive.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.brofive.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1683"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.brofive.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}