{"id":217327,"date":"2020-12-01T05:42:11","date_gmt":"2020-11-30T21:42:11","guid":{"rendered":"http:\/\/4563.org\/?p=217327"},"modified":"2020-12-01T05:42:11","modified_gmt":"2020-11-30T21:42:11","slug":"%e5%85%b3%e4%ba%8e%e5%8d%8f%e7%a8%8b%e8%bd%ac%e7%ba%bf%e7%a8%8b%e7%9a%84%e4%b8%80%e4%b8%aa%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=217327","title":{"rendered":"\u5173\u4e8e\u534f\u7a0b\u8f6c\u7ebf\u7a0b\u7684\u4e00\u4e2a\u95ee\u9898"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5173\u4e8e\u534f\u7a0b\u8f6c\u7ebf\u7a0b\u7684\u4e00\u4e2a\u95ee\u9898               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : abersheeran <\/span>  <span><i><\/i> 2<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u539f\u59cb\u95ee\u9898\u5728\u8fd9 https:\/\/github.com\/abersheeran\/a2wsgi\/issues\/7<\/p>\n<p>\u4ee3\u7801\u5728\u8fd9 https:\/\/github.com\/abersheeran\/a2wsgi\/blob\/55ac9c4b82c6988aa4a8280cfc3fadd2565ed37a\/a2wsgi\/asgi.py<\/p>\n<p>\u6211\u7684\u601d\u8def\u662f\u5b9e\u73b0\u4e00\u5bf9 Event\uff0c\u534f\u7a0b\u91cc\u4f20\u6570\u636e\u7ed9 WSGI \u7ebf\u7a0b\uff0c\u7136\u540e WSGI \u7ebf\u7a0b\u4f20\u6570\u636e\u7ed9\u534f\u7a0b\u3002\u4e4b\u524d\u5de5\u4f5c\u7684\u4e00\u76f4\u8fd8\u884c\uff0c\u76f4\u5230\u90a3\u4e2a issue \u7684\u7528\u4f8b\u91cc\uff0c\u4e24\u4e2a\u534f\u7a0b\u5206\u522b\u8bfb\u548c\u5199\uff0c\u5bfc\u81f4\u7b2c\u4e00\u4e2a\u5199\u7684\u6d88\u606f\u88ab\u8986\u76d6\u4e86\u3002<\/p>\n<p>\u6211\u6628\u5929\u82b1\u4e86\u4e00\u6574\u4e2a\u665a\u4e0a\u4e5f\u6ca1\u60f3\u5230\u4e00\u4e2a\u4f18\u96c5\u7684\u89e3\u51b3\u65b9\u6848\u3002\u6240\u4ee5\u53d1\u51fa\u6765\u8bf7\u6559\u4e00\u4e0b\u5927\u5bb6\uff0c\u6709\u6ca1\u6709\u201c\u7b80\u6d01\u4f18\u96c5\u201d\u7684\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>9<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4417221\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : SaltCat <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u611f\u89c9\u4f60\u7684\u8868\u8ff0\u5e76\u4e0d\u6e05\u695a: \u4f60\u6ca1\u6709\u8bf4\u662f\u5982\u4f55\u4ece coroutine send msg \u5230 thread \u8fdb\u884c\u5904\u7406\u7684(try contextvars); \u7b2c\u4e00\u4e2a\u5199\u7684\u6d88\u606f\u88ab\u8986\u76d6, \u662f\u5426\u8003\u8651\u4f7f\u7528\u7c7b\u4f3c stack \u8fd9\u6837\u7684\u6570\u636e\u7ed3\u6784 + property \u9632\u6b62\u8986\u76d6? \u5982\u679c\u6d89\u53ca\u5230\u540c \/\u5f02\u6b65\u4e0a\u4e0b\u6587\u4f20\u9012, \u53ef\u4ee5\u8003\u8651 `contextvars` \u8fd9\u4e2a\u5e93: asyncio \u5728\u6267\u884c\u534f\u7a0b\u65f6\u4f1a\u590d\u5236\u4e00\u4efd\u5f53\u524d\u7684\u4e0a\u4e0b\u6587\u6765\u6267\u884c, \u4ece\u800c\u907f\u514d\u51fa\u73b0\u8986\u5199\u7684\u95ee\u9898;<br \/>\u5e0c\u671b\u80fd\u89e3\u51b3\u4f60\u7684\u95ee\u9898.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4417222\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : linw1995 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u4e2a async_event \u53ca sync_event \u6bcf\u6b21\u4ea7\u751f\u90fd\u662f\u4e00\u5bf9\u5bf9\u7684\u5417\uff1f\u6bcf\u6b21 send \u6216\u8005 receive \u751f\u6210\u4e00\u4e2a Event \uff08\u6216\u8005\u4e00\u5bf9\uff09\u5c31\u597d\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4417223\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : linw1995 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4ed4\u7ec6\u770b\u4e86\u4e00\u904d\uff0c\u9898\u4e3b\u5e94\u8be5\u662f\u9700\u8981\u7528\u4e2a queue \u628a sync_event \u4e32\u884c\u8d77\u6765\u5427\u3002\u8fd9\u6837\u5c31\u4e0d\u4f1a\u5148\u5904\u7406\u7b2c\u4e8c\u4e2a\u6d88\u606f\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4417224\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : abersheeran <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @linw1995 \u5982\u679c\u7528 Queue \u4e32\u884c\u7684\u8bdd\uff0c\u5728 coroutine \u91cc\u5f80 threading.Queue \u5199\u6570\u636e\u7684\u65f6\u5019\u600e\u4e48\u5f02\u6b65\u7b49\u5f85\u5462\uff1f\u56e0\u4e3a\u9ed8\u8ba4\u662f\u540c\u6b65\u7b49\u5f85\u7684\uff0c\u4f1a\u963b\u585e send \u3001receive \u534f\u7a0b\u3002<\/p>\n<p>@SaltCat \u8c22\u8c22\u4f60\u7684\u5efa\u8bae\uff0c\u4e0d\u8fc7\u8fd9\u4e0d\u662f\u95ee\u9898\u6240\u5728\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4417225\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : linw1995 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @abersheeran aio-libs \u6709\u4e2a\u5e93\u53eb janus \u5e94\u8be5\u80fd\u6ee1\u8db3\u4f60\u7684\u8981\u6c42\u3002<\/p>\n<p>https:\/\/github.com\/aio-libs\/janus                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4417226\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : abersheeran <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @linw1995 \u611f\u8c22\uff01\u770b\u8d77\u6765\u53ef\u4ee5\u89e3\u51b3\u6211\u7684\u95ee\u9898\uff0c\u6211\u770b\u770b\u4ed6\u4ee3\u7801\u600e\u4e48\u505a\u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4417227\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : linw1995 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @abersheeran \u4eca\u5929\u53d1\u73b0\u4e86\u4e00\u4e2a\u548c\u4f60\u5f00\u53d1\u7684\uff0c\u529f\u80fd\u4e00\u6837\u7684\u8f6e\u5b50 https:\/\/github.com\/django\/asgiref                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4417228\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : abersheeran <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @linw1995 \u5144\u5f1f\u4f60\u662f\u5728\u5f00\u73a9\u7b11\u561b\u2026\u2026 asgiref \u662f ASGI \u6807\u51c6\u5e93\u3002\u91cc\u9762\u80af\u5b9a\u662f\u6709\u5b9e\u73b0 WSGI \u5230 ASGI \u7684\u8f6c\u6362\u7684\u554a\uff01\u4f46\u662f\u662f\u4e2a\u53c2\u8003\u5b9e\u73b0\uff0c\u4ec5\u4ec5\u662f\u201d\u53ef\u7528\u201c\uff0c\u901f\u5ea6\u5f88\u5dee\u52b2\uff0c\u800c\u4e14\u4f1a\u9884\u8bfb request body\uff0c\u5927\u6587\u4ef6\u4e00\u6765\u5b83\u5c31\u6b7b\u4e86\uff08\u540c\u7406\uff0cuvicorn \u3001starlette \u91cc\u9762\u81ea\u5e26\u7684\u4e5f\u4e00\u6837\uff09\u3002\u4f60\u53ef\u4ee5\u770b\u770b a2wsgi \u9879\u76ee\u91cc\u63d0\u4f9b\u7684 benchmark \u3002<\/p>\n<p>\u518d\u544a\u8bc9\u4f60\u4e00\u4e2a\u79d8\u5bc6\uff0c\u5982\u679c\u4f60\u770b\u770b asgiref \u8d21\u732e\u8005\u540d\u5355\uff0c\u4f60\u4f1a\u53d1\u73b0\u6211\u4e5f\u5728\u91cc\u9762                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4417229\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : linw1995 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @abersheeran 233 \u6211\u5bf9\u8fd9\u65b9\u9762\u90fd\u4e0d\u5173\u6ce8\u7684\u3002\u8fd9\u4e2a\u5e93\u662f\u5728 mitmproxy \u6e90\u7801\u91cc\u53d1\u73b0\u7684\uff0c\u8fd8\u4ee5\u4e3a\u8fd9\u4e2a\u666e\u901a\u8f6e\u5b50\u3002\u539f\u6765\u662f\u6839\u6b63\u82d7\u7ea2\u7684\u5b98\u65b9\u8f6e\u5b50_(:_\u300d\u2220)_                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5173\u4e8e\u534f\u7a0b\u8f6c\u7ebf\u7a0b\u7684\u4e00\u4e2a\u95ee\u9898 \u8cc7\u6df1\u5927\u4f6c&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/217327"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=217327"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/217327\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=217327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=217327"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=217327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}