{"id":10020420,"date":"2024-11-28T10:25:37","date_gmt":"2024-11-28T02:25:37","guid":{"rendered":"https:\/\/itmax.cn\/?p=10020420"},"modified":"2024-11-28T10:25:37","modified_gmt":"2024-11-28T02:25:37","slug":"%e8%ae%b0%e5%bd%95%e4%b8%80%e4%b8%aa-nameko-standalone-rpc-%e5%ba%94%e7%ad%94%e4%b8%8d%e6%b6%88%e8%b4%b9%e5%af%bc%e8%87%b4%e9%98%bb%e5%a1%9e%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10020420","title":{"rendered":"\u8bb0\u5f55\u4e00\u4e2a nameko standalone rpc \u5e94\u7b54\u4e0d\u6d88\u8d39\u5bfc\u81f4\u963b\u585e\u7684\u95ee\u9898"},"content":{"rendered":"<p>\u4f7f\u7528 nameko standalone rpc \u8c03\u7528\u5176\u4ed6 rpc \u670d\u52a1\u7684\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<pre><code class=\"python\">from nameko.standalone.rpc import ClusterRpcProxy\n\nwith ClusterRpcProxy(config) as cluster_rpc:\n    parse_result_json = cluster_rpc.parse_rpc_service.parse_rpc_v3(\n        parser_result.json(ensure_ascii=False)\n    )<\/code><\/pre>\n<p>\u5148\u660e\u786e\u4e24\u4e2a\u89d2\u8272\uff1a<\/p>\n<ul>\n<li>nameko rpc \u5ba2\u6237\u7aef\uff0c\u4e0a\u9762\u7684\u4ee3\u7801\u5c31\u662f\u5ba2\u6237\u7aef\u4ee3\u7801<\/li>\n<li>nameko rpc \u670d\u52a1\u7aef<\/li>\n<\/ul>\n<p>\u9047\u5230\u4e86\u4e00\u4e2a\u95ee\u9898\uff0c\u5c31\u662f rpc \u670d\u52a1\u7aef\u5df2\u7ecf\u8fd4\u56de\u6570\u636e\u4e86\uff08\u670d\u52a1\u7aef\u662f\u628a\u6570\u636e\u63a8\u5230 rabbitmq \u5373\u89c6\u4e3a\u8fd4\u56de\u6570\u636e\u5b8c\u6210\uff09\uff0c\u4f46\u662f rpc \u5ba2\u6237\u7aef\u4e00\u76f4\u5904\u4e8e\u6570\u636e\u6d88\u8d39\u4e2d\u3002\u6240\u4ee5\u95ee\u9898\u662f\u51fa\u5728\u5ba2\u6237\u7aef\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u7aef<\/p>\n<p>\u51fa\u73b0\u4e86\u7c7b\u4f3c\u4e0b\u9762\u683c\u5f0f\u7684 10\u4e2a\u961f\u5217<\/p>\n<pre><code class=\"log\">http:\/\/xxxx:15672\/#\/queues\/xxx-test\/rpc.reply-standalone_rpc_proxy-cde4457d-a580-4672-8a94-1cf4b5fce9f0\n\nhttp:\/\/xxxx:15672\/#\/queues\/xxx-test\/rpc.reply-standalone_rpc_proxy-a1ad897c-48d6-4ff0-b975-9e83ec79916d<\/code><\/pre>\n<p>\u95ee\u9898\u4ece rabbitmq \u770b\u5c31\u662f total \u5217\u7684\u503c\u662f 1\uff0cunacked \u4e5f\u662f 1\u3002\u4e14\u4e00\u76f4\u4e0d\u6d88\u8d39<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"723\" height=\"200\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVde6vM\" alt=\"\u56fe\u7247.png\" title=\"\u56fe\u7247.png\"><\/p>\n<blockquote><p>\u91cd\u542f nameko rpc \u5ba2\u6237\u7aef\u7684\u7a0b\u5e8f\uff08kill \u8fdb\u7a0b\uff09\u95ee\u9898\u5c31\u4f1a\u968f\u4e4b\u6d88\u5931<\/p><\/blockquote>\n<p>\u961f\u5217\u9875\u9762\u7684\u8be6\u60c5\u662f\u8fd9\u6837<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"423\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVde6vi\" alt=\"\u56fe\u7247.png\" title=\"\u56fe\u7247.png\" loading=\"lazy\"><\/p>\n<p>\u6d88\u8d39\u8005\u9875\u9762\u8be6\u60c5\u662f\u8fd9\u6837<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"506\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVde6wb\" alt=\"\u56fe\u7247.png\" title=\"\u56fe\u7247.png\" loading=\"lazy\"><\/p>\n<p>\u81f3\u4e8e\u95ee\u9898\u4ea7\u751f\u7684\u539f\u56e0\uff0c\u8fd8\u4e0d\u6e05\u695a\uff0c\u9700\u8981\u7b49\u4e0b\u4e00\u6b21\u518d\u53d1\u751f\u7684\u65f6\u5019\uff0c\u518d\u8fdb\u4e00\u6b65\u8c03\u67e5<\/p>\n<p>\u4e0d\u8fc7\u6211\u521d\u6b65\u6000\u7591\u662f\u5f15\u5165\u4e86\u4e00\u4e9b\u548c eventlet \u534f\u7a0b\u4e0d\u517c\u5bb9\u7684\u4ee3\u7801\uff0c\u5bfc\u81f4 cpu \u4f1a\u593a\u8d70\u5bfc\u81f4\u7684<\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000045506505\">https:\/\/segmentfault.com\/a\/1190000045506505<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528 nameko standalone rpc \u8c03\u7528\u5176\u4ed6 rpc \u670d\u52a1\u7684\u793a\u4f8b\u4ee3\u7801\uff1a from nameko. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10020420","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10020420","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10020420"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10020420\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10020420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10020420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10020420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}