{"id":2683,"date":"2018-04-20T21:39:33","date_gmt":"2018-04-20T13:39:33","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2683"},"modified":"2018-04-20T21:39:33","modified_gmt":"2018-04-20T13:39:33","slug":"%e8%9a%82%e8%9a%81-sofabolt-%e6%a1%86%e6%9e%b6%e7%ae%80%e4%bb%8b","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2683","title":{"rendered":"\u8682\u8681 SOFABolt \u6846\u67b6\u7b80\u4ecb"},"content":{"rendered":"<p>\n\tSOFABolt \u662f\u8682\u8681\u91d1\u878d\u670d\u52a1\u96c6\u56e2\u5f00\u53d1\u7684\u4e00\u5957\u57fa\u4e8e Netty \u5b9e\u73b0\u7684\u7f51\u7edc\u901a\u4fe1\u6846\u67b6\u3002\n<\/p>\n<ul>\n<li>\n\t\t\u4e3a\u4e86\u8ba9 Java \u7a0b\u5e8f\u5458\u80fd\u5c06\u66f4\u591a\u7684\u7cbe\u529b\u653e\u5728\u57fa\u4e8e\u7f51\u7edc\u901a\u4fe1\u7684\u4e1a\u52a1\u903b\u8f91\u5b9e\u73b0\u4e0a\uff0c\u800c\u4e0d\u662f\u8fc7\u591a\u7684\u7ea0\u7ed3\u4e8e\u7f51\u7edc\u5e95\u5c42 NIO \u7684\u5b9e\u73b0\u4ee5\u53ca\u5904\u7406\u96be\u4ee5\u8c03\u8bd5\u7684\u7f51\u7edc\u95ee\u9898\uff0cNetty \u5e94\u8fd0\u800c\u751f\u3002\n\t<\/li>\n<li>\n\t\t\u4e3a\u4e86\u8ba9\u4e2d\u95f4\u4ef6\u5f00\u53d1\u8005\u80fd\u5c06\u66f4\u591a\u7684\u7cbe\u529b\u653e\u5728\u4ea7\u54c1\u529f\u80fd\u7279\u6027\u5b9e\u73b0\u4e0a\uff0c\u800c\u4e0d\u662f\u91cd\u590d\u5730\u4e00\u904d\u904d\u5236\u9020\u901a\u4fe1\u6846\u67b6\u7684\u8f6e\u5b50\uff0cSOFABolt \u5e94\u8fd0\u800c\u751f\u3002\n\t<\/li>\n<\/ul>\n<p>\n\tBolt \u540d\u5b57\u53d6\u81ea\u8fea\u58eb\u5c3c\u52a8\u753b-\u95ea\u7535\u72d7\uff0c\u662f\u4e00\u4e2a\u57fa\u4e8e Netty \u6700\u4f73\u5b9e\u8df5\u7684\u8f7b\u91cf\u3001\u6613\u7528\u3001\u9ad8\u6027\u80fd\u3001\u6613\u6269\u5c55\u7684\u901a\u4fe1\u6846\u67b6\u3002 \u8fd9\u4e9b\u5e74\u6211\u4eec\u5728\u5fae\u670d\u52a1\u4e0e\u6d88\u606f\u4e2d\u95f4\u4ef6\u5728\u7f51\u7edc\u901a\u4fe1\u4e0a\u89e3\u51b3\u8fc7\u5f88\u591a\u95ee\u9898\uff0c\u79ef\u7d2f\u4e86\u5f88\u591a\u7ecf\u9a8c\uff0c\u5e76\u6301\u7eed\u7684\u8fdb\u884c\u7740\u4f18\u5316\u548c\u5b8c\u5584\uff0c\u6211\u4eec\u5e0c\u671b\u80fd\u628a\u603b\u7ed3\u51fa\u7684\u89e3\u51b3\u65b9\u6848\u6c89\u6dc0\u5230 SOFABolt \u8fd9\u4e2a\u57fa\u7840\u7ec4\u4ef6\u91cc\uff0c\u8ba9\u66f4\u591a\u7684\u4f7f\u7528\u7f51\u7edc\u901a\u4fe1\u7684\u573a\u666f\u80fd\u591f\u7edf\u4e00\u53d7\u76ca\u3002 \u76ee\u524d\u8be5\u4ea7\u54c1\u5df2\u7ecf\u8fd0\u7528\u5728\u4e86\u8682\u8681\u4e2d\u95f4\u4ef6\u7684\u5fae\u670d\u52a1 (<a href=\"https:\/\/www.xttblog.com\/?p=2679\" name=\"\u8682\u8681 SOFARPC \u6559\u7a0b\" target=\"_blank\" title=\"\u8682\u8681 SOFARPC \u6559\u7a0b\">SOFARPC<\/a>)\u3001\u6d88\u606f\u4e2d\u5fc3\u3001\u5206\u5e03\u5f0f\u4e8b\u52a1\u3001\u5206\u5e03\u5f0f\u5f00\u5173\u3001\u4ee5\u53ca\u914d\u7f6e\u4e2d\u5fc3\u7b49\u4f17\u591a\u4ea7\u54c1\u4e0a\u3002\n<\/p>\n<h1>\n\t\u529f\u80fd\u4ecb\u7ecd<br \/>\n<\/h1>\n<p>\n\t<a href=\"https:\/\/github.com\/alipay\/sofa-bolt\/blob\/master\/.middleware-common\/intro.png\" target=\"_blank\"><img decoding=\"async\" alt=\"intro\" src=\"https:\/\/github.com\/alipay\/sofa-bolt\/raw\/master\/.middleware-common\/intro.png\" \/><\/a>\n<\/p>\n<h2>\n\tSOFABolt\u3000\u7684\u57fa\u7840\u529f\u80fd\u5305\u62ec\uff1a<br \/>\n<\/h2>\n<ul>\n<li>\n\t\t\u57fa\u7840\u901a\u4fe1\u529f\u80fd ( remoting-core )<\/p>\n<ul>\n<li>\n\t\t\t\t\u57fa\u4e8e Netty \u9ad8\u6548\u7684\u7f51\u7edc IO \u4e0e\u7ebf\u7a0b\u6a21\u578b\u8fd0\u7528\n\t\t\t<\/li>\n<li>\n\t\t\t\t\u8fde\u63a5\u7ba1\u7406 (\u65e0\u9501\u5efa\u8fde\uff0c\u5b9a\u65f6\u65ad\u94fe\uff0c\u81ea\u52a8\u91cd\u8fde)\n\t\t\t<\/li>\n<li>\n\t\t\t\t\u57fa\u7840\u901a\u4fe1\u6a21\u578b ( oneway\uff0csync\uff0cfuture\uff0ccallback )\n\t\t\t<\/li>\n<li>\n\t\t\t\t\u8d85\u65f6\u63a7\u5236\n\t\t\t<\/li>\n<li>\n\t\t\t\t\u6279\u91cf\u89e3\u5305\u4e0e\u6279\u91cf\u63d0\u4ea4\u5904\u7406\u5668\n\t\t\t<\/li>\n<li>\n\t\t\t\t\u5fc3\u8df3\u4e0e IDLE \u4e8b\u4ef6\u5904\u7406\n\t\t\t<\/li>\n<\/ul>\n<\/li>\n<li>\n\t\t\u534f\u8bae\u6846\u67b6 ( protocol-skeleton )<\/p>\n<ul>\n<li>\n\t\t\t\t\u547d\u4ee4\u4e0e\u547d\u4ee4\u5904\u7406\u5668\n\t\t\t<\/li>\n<li>\n\t\t\t\t\u7f16\u89e3\u7801\u5904\u7406\u5668\n\t\t\t<\/li>\n<li>\n\t\t\t\t\u5fc3\u8df3\u89e6\u53d1\u5668\n\t\t\t<\/li>\n<\/ul>\n<\/li>\n<li>\n\t\t\u79c1\u6709\u534f\u8bae\u5b9a\u5236\u5b9e\u73b0 &#8211; RPC \u901a\u4fe1\u534f\u8bae ( protocol-implementation )<\/p>\n<ul>\n<li>\n\t\t\t\tRPC \u901a\u4fe1\u534f\u8bae\u7684\u8bbe\u8ba1\n\t\t\t<\/li>\n<li>\n\t\t\t\t\u7075\u6d3b\u7684\u53cd\u5e8f\u5217\u5316\u65f6\u673a\u63a7\u5236\n\t\t\t<\/li>\n<li>\n\t\t\t\t\u8bf7\u6c42\u5904\u7406\u8d85\u65f6 FailFast \u673a\u5236\n\t\t\t<\/li>\n<li>\n\t\t\t\t\u7528\u6237\u8bf7\u6c42\u5904\u7406\u5668 ( UserProcessor )\n\t\t\t<\/li>\n<li>\n\t\t\t\t\u53cc\u5de5\u901a\u4fe1\n\t\t\t<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>\n\t\u7528\u6cd51<br \/>\n<\/h2>\n<p>\n\t\u5c06 SOFABolt \u7528\u4f5c\u4e00\u4e2a\u8fdc\u7a0b\u901a\u4fe1\u6846\u67b6\uff0c\u4f7f\u7528\u8005\u53ef\u4ee5\u4e0d\u7528\u5173\u5fc3\u5982\u4f55\u5b9e\u73b0\u4e00\u4e2a\u79c1\u6709\u534f\u8bae\u7684\u7ec6\u8282\uff0c\u76f4\u63a5\u4f7f\u7528\u6211\u4eec\u5185\u7f6e\u7684 RPC \u901a\u4fe1\u534f\u8bae\u3002\u53ef\u4ee5\u975e\u5e38\u7b80\u5355\u7684\u542f\u52a8\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u7aef\uff0c\u540c\u65f6\u6ce8\u518c\u4e00\u4e2a\u7528\u6237\u8bf7\u6c42\u5904\u7406\u5668\uff0c\u5373\u53ef\u5b8c\u6210\u8fdc\u7a0b\u8c03\u7528\u3002\u540c\u65f6\uff0c\u50cf\u8fde\u63a5\u7ba1\u7406\u3001\u5fc3\u8df3\u7b49\u57fa\u7840\u529f\u80fd\u7279\u6027\u90fd\u9ed8\u8ba4\u53ef\u4ee5\u4f7f\u7528\u3002 \u5f53\u524d\u652f\u6301\u7684\u8c03\u7528\u7c7b\u578b\u5982\u4e0b\u56fe\u6240\u793a\uff1a\n<\/p>\n<p>\n\t<a href=\"https:\/\/github.com\/alipay\/sofa-bolt\/blob\/master\/.middleware-common\/invoke_types.png\" target=\"_blank\"><img decoding=\"async\" alt=\"invoke_type\" src=\"https:\/\/github.com\/alipay\/sofa-bolt\/raw\/master\/.middleware-common\/invoke_types.png\" \/><\/a>\n<\/p>\n<p>\n\t\u540e\u9762\u4f1a\u6709\u5177\u4f53\u7684\u7bc7\u5e45\u548c\u6587\u7ae0\u6765\u4ecb\u7ecd\u3002\n<\/p>\n<h2>\n\t\u7528\u6cd52<br \/>\n<\/h2>\n<p>\n\t\u5c06 SOFABolt \u7528\u4f5c\u4e00\u4e2a\u534f\u8bae\u6846\u67b6\uff0c\u4f7f\u7528\u8005\u53ef\u4ee5\u590d\u7528\u57fa\u7840\u7684\u901a\u4fe1\u6a21\u578b\u3001\u534f\u8bae\u5305\u542b\u7684\u63a5\u53e3\u5b9a\u4e49\u7b49\u57fa\u7840\u529f\u80fd\u3002\u7136\u540e\u6839\u636e\u81ea\u5df1\u8bbe\u8ba1\u7684\u79c1\u6709\u534f\u8bae\u81ea\u5b9a\u4e49 Command \u7c7b\u578b\u3001Command \u5904\u7406\u5668\u3001\u7f16\u89e3\u7801\u5904\u7406\u5668\u7b49\u3002\u5982\u4e0b\u56fe\u6240\u793a\uff0cRPC \u548c\u6d88\u606f\u7684 Command \u5b9a\u4e49\u7ed3\u6784\uff1a\n<\/p>\n<p>\n\t<a href=\"https:\/\/github.com\/alipay\/sofa-bolt\/blob\/master\/.middleware-common\/msg_protocol.png\" target=\"_blank\"><img decoding=\"async\" alt=\"msg_protocol\" src=\"https:\/\/github.com\/alipay\/sofa-bolt\/raw\/master\/.middleware-common\/msg_protocol.png\" \/><\/a><\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2683\">\u8682\u8681 SOFABolt \u6846\u67b6\u7b80\u4ecb<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>SOFABolt \u662f\u8682\u8681\u91d1\u878d\u670d\u52a1\u96c6\u56e2\u5f00\u53d1\u7684\u4e00\u5957\u57fa\u4e8e Netty \u5b9e\u73b0\u7684\u7f51\u7edc\u901a\u4fe1\u6846\u67b6\u3002 \u4e3a\u4e86\u8ba9 Java \u7a0b\u5e8f\u5458 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-2683","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2683"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2683\/revisions"}],"predecessor-version":[{"id":2684,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2683\/revisions\/2684"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}