uvloop官网翻译
<body> <header style="background-image: url(formula.jpg)" class="mb-head"><div class="row"><div class="large-12 columns"><h1 class="m-logo"><a href="/"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">魔术堆栈</font></font></a></h1><div class="title-cnt"><h1><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">uvloop:快速的Python网络连接</font></font></h1><h2><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">作者Yury </font></font><a href="http://twitter.com/1st1"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">Selivanov @ 1st1</font></font></a><br><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"> 2016年5月3日</font></font></h2></div></div></div></header> <article class="mb-article"><section><div class="row"><div class="large-9 columns"><h2><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">TL; DR</font></font></h2></div></div><div class="row"><div class="large-9 columns"><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">asyncio是Python标准库附带的异步I / O框架。</font><font style="vertical-align: inherit;">在此博客文章中,我们介绍</font></font><a href="https://github.com/MagicStack/uvloop"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">uvloop</font></font></a><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">:asyncio事件循环的完整替代品。</font><font style="vertical-align: inherit;">uvloop用Cython编写,并建立在</font></font><a href="http://libuv.org"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">libuv之上</font></font></a><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">。</font></font></p><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">uvloop使asyncio更快。</font><font style="vertical-align: inherit;">实际上,它至少</font><font style="vertical-align: inherit;">比nodejs,gevent和任何其他Python异步框架</font></font><b><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">快2倍</font></font></b><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">。</font><font style="vertical-align: inherit;">基于uvloop的asyncio的性能接近Go程序。</font></font></p></div><div class="large-3 columns mb-sidebar"><p><span></span></p></div></div><div class="row"><div class="large-9 columns"><h2><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">异步和uvloop</font></font></h2></div></div><div class="row"><div class="large-9 columns"><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">PEP 3156引入的asyncio模块是网络传输,协议和流抽象的集合,带有可插入事件循环。</font><font style="vertical-align: inherit;">事件循环是异步的核心。</font><font style="vertical-align: inherit;">它提供以下API:</font></font></p><ul><li><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">安排电话</font></font></li><li><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">通过网络传输数据,</font></font></li><li><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">执行DNS查询,</font></font></li><li><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">处理操作系统信号,</font></font></li><li><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">方便的抽象来创建服务器和连接,</font></font></li><li><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">异步处理子流程。</font></font></li></ul></div><div class="large-3 columns mb-sidebar"><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"> 目前,uvloop仅在* nix平台和Python 3.5上可用。 </font></font></p></div></div><div class="row"><div class="large-9 columns"><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">uvloop是内置asyncio事件循环的替代产品。</font><font style="vertical-align: inherit;">您可以使用pip安装uvloop:</font></font></p><pre class="code"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$ pip安装uvloop</font></font></pre><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">在异步代码中使用uvloop很简单:</font></font></p><pre class="code"><b><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">导入</font></font></b><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">异步
</font></font><b><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">导入</font></font></b><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"> uvloop</font></font><font></font><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())</font></font></pre><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">上面的代码片段使任何</font></font><code>asyncio.get_event_loop()</code><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">调用都返回uvloop的实例。</font></font></p></div><div class="large-3 columns mb-sidebar"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"> 您还可以通过调用显式创建uvloop实例 </font></font><code>uvloop.new_event_loop()</code></div></div><div class="row"><div class="large-9 columns"><h2><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">建筑</font></font></h2></div></div><div class="row"><div class="large-9 columns"><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">uvloop用Cython编写,并建立在libuv之上。</font></font></p><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">libuv是供nodejs使用的高性能,多平台异步I / O库。</font><font style="vertical-align: inherit;">由于nodejs的普及和流行,libuv既快速又稳定。</font></font></p><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">uvloop实现所有异步事件循环API。</font><font style="vertical-align: inherit;">高级Python对象包装了低级libuv结构和函数。</font><font style="vertical-align: inherit;">继承用于保持代码DRY并确保任何手动内存管理与libuv原语的寿命保持同步。</font></font></p></div></div><div class="row"><div class="large-9 columns"><h2><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">基准测试</font></font></h2></div></div><div class="row"><div class="large-9 columns"><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">为了检查uvloop的性能如何与其他实现相提并论,我们创建了一个</font></font><a href="https://github.com/MagicStack/vmbench"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">工具台</font></font></a><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">来对TCP和UNIX套接字I / O以及HTTP协议的性能进行基准测试。</font></font></p></div><div class="large-3 columns mb-sidebar"><p><span></span></p></div></div><div class="row"><div class="large-9 columns"><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">标有基准的服务器在带有外部负载生成工具(</font><font style="vertical-align: inherit;">HTTP基准的</font></font><a href="https://github.com/wg/wrk"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">wrk</font></font></a><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">)</font><font style="vertical-align: inherit;">的Docker容器中运行,该工具</font><font style="vertical-align: inherit;">可以测量请求的吞吐量和延迟。</font></font></p><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">本博客文章中的所有基准测试均在3.70GHz的Intel Xeon CPU E5-1620 v2和Ubuntu Linux上运行。</font><font style="vertical-align: inherit;">我们使用Python 3.5,所有服务器均为单线程。</font><font style="vertical-align: inherit;">另外,我们使用</font></font><code>GOMAXPROCS=1</code><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">Go代码,nodejs不使用集群,并且所有Python服务器都是单进程的。</font><font style="vertical-align: inherit;">每个基准设置</font></font><code>TCP_NODELAY</code><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">标志。</font></font></p><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">Mac OS X上的基准测试结果非常相似。</font></font></p></div></div><div class="row"><div class="large-9 columns"><h3><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">TCP协议</font></font></h3></div></div><div class="row"><div class="large-9 columns"><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">此基准测试了具有不同消息大小的简单回显服务器的性能。</font><font style="vertical-align: inherit;">我们使用1、10和100 KiB软件包。</font><font style="vertical-align: inherit;">并发级别为10。每个基准测试运行30秒。</font></font></p></div><div class="large-3 columns mb-sidebar"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">另请参阅完整的TCP基准</font></font><a href="tcp-bench.html"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">报告</font></font></a><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">。</font></font></div></div><div class="row"><div class="large-12 columns"><div class="mb-charts"><svg id="tcp_bars" class="chart" style="width: 100%" viewBox="0 0 1000 370"><g transform="translate(65,10)"><g class="x axis" transform="translate(0,305)"><g class="tick" transform="translate(50,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">asyncio</text></g><g class="tick" transform="translate(127,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">tornado</text></g><g class="tick" transform="translate(204,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">curio</text></g><g class="tick" transform="translate(281,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">twisted</text></g><g class="tick" transform="translate(358,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">curio</text></g><g class="tick" transform="translate(435,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">uvloop</text></g><g class="tick" transform="translate(512,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">gevent</text></g><g class="tick" transform="translate(589,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">asyncio</text></g><g class="tick" transform="translate(666,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">nodejs</text></g><g class="tick" transform="translate(743,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">uvloop</text></g><g class="tick" transform="translate(820,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">golang</text></g><path class="domain" d="M0,6V0H870V6"></path></g><g class="x axis x2" transform="translate(0,319)"><g class="tick" transform="translate(50,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">streams</text></g><g class="tick" transform="translate(127,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(204,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">streams</text></g><g class="tick" transform="translate(281,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(358,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(435,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">streams</text></g><g class="tick" transform="translate(512,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(589,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(666,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(743,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(820,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><path class="domain" d="M0,6V0H870V6"></path></g><g class="y axis"><g class="tick" transform="translate(0,305)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">0</text></g><g class="tick" transform="translate(0,276.0786981810872)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">10,000</text></g><g class="tick" transform="translate(0,247.15739636217435)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">20,000</text></g><g class="tick" transform="translate(0,218.23609454326154)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">30,000</text></g><g class="tick" transform="translate(0,189.31479272434868)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">40,000</text></g><g class="tick" transform="translate(0,160.39349090543587)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">50,000</text></g><g class="tick" transform="translate(0,131.47218908652306)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">60,000</text></g><g class="tick" transform="translate(0,102.55088726761025)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">70,000</text></g><g class="tick" transform="translate(0,73.62958544869741)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">80,000</text></g><g class="tick" transform="translate(0,44.708283629784596)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">90,000</text></g><g class="tick" transform="translate(0,15.786981810871787)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">100,000</text></g><path class="domain" d="M-6,0H0V305H-6"></path><text transform="rotate(-90)" y="6" dy=".71em" style="text-anchor: end;">Requests / sec</text></g><g class="legend" transform="translate(870, 20)"><circle cx="0" cy="0" r="5" style="fill: rgb(152, 171, 197);"></circle><text x="7" y="0" alignment-baseline="central">1 KiB</text></g><g class="legend" transform="translate(870, 20)"><circle cx="0" cy="20" r="5" style="fill: rgb(107, 72, 107);"></circle><text x="7" y="20" alignment-baseline="central">10 KiB</text></g><g class="legend" transform="translate(870, 20)"><circle cx="0" cy="40" r="5" style="fill: rgb(255, 140, 0);"></circle><text x="7" y="40" alignment-baseline="central">100 KiB</text></g><g class="bench" transform="translate(19,0)"><rect width="15" x="4" y="253.72542400524947" height="51.274575994750535" style="fill: rgb(152, 171, 197);"></rect><rect width="15" x="23" y="263.46013174838276" height="41.539868251617236" style="fill: rgb(107, 72, 107);"></rect><rect width="15" x="42" y="279.19352238698406" height="25.806477613015943" style="fill: rgb(255, 140, 0);"></rect></g><g class="bench" transform="translate(96,0)"><rect width="15" x="4" y="247.55497749827893" height="57.44502250172107" style="fill: rgb(152, 171, 197);"></rect><rect width="15" x="23" y="251.26488641040183" height="53.73511358959817" style="fill: rgb(107, 72, 107);"></rect><rect width="15" x="42" y="285.31529434299335" height="19.684705657006646" style="fill: rgb(255, 140, 0);"></rect></g><g class="bench" transform="translate(173,0)"><rect width="15" x="4" y="249.6087659043454" height="55.391234095654596" style="fill: rgb(152, 171, 197);"></rect><rect width="15" x="23" y="253.4135656077361" height="51.5864343922639" style="fill: rgb(107, 72, 107);"></rect><rect width="15" x="42" y="272.81339644182646" height="32.186603558173545" style="fill: rgb(255, 140, 0);"></rect></g><g class="bench" transform="translate(250,0)"><rect width="15" x="4" y="236.5100190975416" height="68.4899809024584" style="fill: rgb(152, 171, 197);"></rect><rect width="15" x="23" y="243.63304652252165" height="61.36695347747835" style="fill: rgb(107, 72, 107);"></rect><rect width="15" x="42" y="271.40241288998715" height="33.59758711001285" style="fill: rgb(255, 140, 0);"></rect></g><g class="bench" transform="translate(327,0)"><rect width="15" x="4" y="232.28192722072927" height="72.71807277927073" style="fill: rgb(152, 171, 197);"></rect><rect width="15" x="23" y="237.8237113900621" height="67.1762886099379" style="fill: rgb(107, 72, 107);"></rect><rect width="15" x="42" y="262.6595033501298" height="42.340496649870204" style="fill: rgb(255, 140, 0);"></rect></g><g class="bench" transform="translate(404,0)"><rect width="15" x="4" y="212.6535024170622" height="92.34649758293779" style="fill: rgb(152, 171, 197);"></rect><rect width="15" x="23" y="223.2943434674839" height="81.70565653251609" style="fill: rgb(107, 72, 107);"></rect><rect width="15" x="42" y="272.7379986079846" height="32.26200139201541" style="fill: rgb(255, 140, 0);"></rect></g><g class="bench" transform="translate(481,0)"><rect width="15" x="4" y="216.67347660598568" height="88.32652339401432" style="fill: rgb(152, 171, 197);"></rect><rect width="15" x="23" y="225.23698731066028" height="79.76301268933972" style="fill: rgb(107, 72, 107);"></rect><rect width="15" x="42" y="266.08098011921265" height="38.919019880787346" style="fill: rgb(255, 140, 0);"></rect></g><g class="bench" transform="translate(558,0)"><rect width="15" x="4" y="185.20854629209947" height="119.79145370790053" style="fill: rgb(152, 171, 197);"></rect><rect width="15" x="23" y="206.24222822984564" height="98.75777177015436" style="fill: rgb(107, 72, 107);"></rect><rect width="15" x="42" y="268.4532209796072" height="36.54677902039282" style="fill: rgb(255, 140, 0);"></rect></g><g class="bench" transform="translate(635,0)"><rect width="15" x="4" y="177.58682885985593" height="127.41317114014407" style="fill: rgb(152, 171, 197);"></rect><rect width="15" x="23" y="199.39233357924346" height="105.60766642075654" style="fill: rgb(107, 72, 107);"></rect><rect width="15" x="42" y="271.85552292558407" height="33.14447707441593" style="fill: rgb(255, 140, 0);"></rect></g><g class="bench" transform="translate(712,0)"><rect width="15" x="4" y="0" height="305" style="fill: rgb(152, 171, 197);"></rect><rect width="15" x="23" y="65.4595201339673" height="239.54047986603268" style="fill: rgb(107, 72, 107);"></rect><rect width="15" x="42" y="237.0487361865225" height="67.95126381347751" style="fill: rgb(255, 140, 0);"></rect></g><g class="bench" transform="translate(789,0)"><rect width="15" x="4" y="6.347444874102295" height="298.6525551258977" style="fill: rgb(152, 171, 197);"></rect><rect width="15" x="23" y="61.48978224630332" height="243.51021775369668" style="fill: rgb(107, 72, 107);"></rect><rect width="15" x="42" y="223.07289305945653" height="81.92710694054347" style="fill: rgb(255, 140, 0);"></rect></g><g class="focus" style="display: none;"><rect x="-65" width="59" y="0" height="18" fill="rgba(255, 255, 255, 0.9)"></rect><line x1="-6" x2="850" y1="0" y2="0" style="stroke-dasharray: 2, 2;"></line><text y="0" x="-9" text-anchor="end" alignment-baseline="middle"></text></g></g></svg><svg id="tcp_lats" class="chart" style="width: 100%" viewBox="0 0 1000 370"><g transform="translate(65,10)"><g class="x axis" transform="translate(0,305)"><g class="tick" transform="translate(50,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">asyncio</text></g><g class="tick" transform="translate(127,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">tornado</text></g><g class="tick" transform="translate(204,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">curio</text></g><g class="tick" transform="translate(281,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">twisted</text></g><g class="tick" transform="translate(358,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">curio</text></g><g class="tick" transform="translate(435,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">uvloop</text></g><g class="tick" transform="translate(512,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">gevent</text></g><g class="tick" transform="translate(589,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">asyncio</text></g><g class="tick" transform="translate(666,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">nodejs</text></g><g class="tick" transform="translate(743,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">uvloop</text></g><g class="tick" transform="translate(820,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">golang</text></g><path class="domain" d="M0,6V0H870V6"></path></g><g class="x axis x2" transform="translate(0,319)"><g class="tick" transform="translate(50,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">streams</text></g><g class="tick" transform="translate(127,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(204,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">streams</text></g><g class="tick" transform="translate(281,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(358,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(435,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">streams</text></g><g class="tick" transform="translate(512,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(589,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(666,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(743,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(820,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><path class="domain" d="M0,6V0H870V6"></path></g><g class="y axis"><g class="tick" transform="translate(0,305)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">0.0</text></g><g class="tick" transform="translate(0,279.74120082815733)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">0.2</text></g><g class="tick" transform="translate(0,254.48240165631472)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">0.4</text></g><g class="tick" transform="translate(0,229.22360248447205)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">0.6</text></g><g class="tick" transform="translate(0,203.9648033126294)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">0.8</text></g><g class="tick" transform="translate(0,178.70600414078675)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">1.0</text></g><g class="tick" transform="translate(0,153.44720496894408)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">1.2</text></g><g class="tick" transform="translate(0,128.18840579710147)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">1.4</text></g><g class="tick" transform="translate(0,102.9296066252588)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">1.6</text></g><g class="tick" transform="translate(0,77.67080745341616)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">1.8</text></g><g class="tick" transform="translate(0,52.41200828157352)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">2.0</text></g><g class="tick" transform="translate(0,27.153209109730845)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">2.2</text></g><g class="tick" transform="translate(0,1.8944099378882022)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">2.4</text></g><path class="domain" d="M-6,0H0V305H-6"></path><text transform="rotate(-90)" y="6" dy=".71em" style="text-anchor: end;">Latency (msec)</text></g><g class="legend" transform="translate(870, 20)"><circle cx="0" cy="0" r="5" style="fill: rgb(152, 171, 197);"></circle><text x="7" y="0" alignment-baseline="central">1 KiB</text></g><g class="legend" transform="translate(870, 20)"><circle cx="0" cy="20" r="5" style="fill: rgb(107, 72, 107);"></circle><text x="7" y="20" alignment-baseline="central">10 KiB</text></g><g class="legend" transform="translate(870, 20)"><circle cx="0" cy="40" r="5" style="fill: rgb(255, 140, 0);"></circle><text x="7" y="40" alignment-baseline="central">100 KiB</text></g><g class="bench" transform="translate(19,0)"><g class="sub"><line y1="213.94202898550728" y2="213.94202898550728" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="288.58178053830227" y2="288.58178053830227" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="236.04347826086956" y2="236.04347826086956" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="288.58178053830227" y2="236.92753623188406" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><line y1="213.94202898550728" y2="234.6542443064182" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><rect y="234.6542443064182" x="7" width="13" height="2.2732919254658555" style="stroke: rgb(152, 171, 197); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="7" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="192.97722567287786" y2="192.97722567287786" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="292.37060041407864" y2="292.37060041407864" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="220.13043478260872" y2="220.13043478260872" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="292.37060041407864" y2="222.1511387163561" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><line y1="192.97722567287786" y2="216.46790890269153" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><rect y="216.46790890269153" x="25" width="13" height="5.683229813664553" style="stroke: rgb(107, 72, 107); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="25" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="127.17805383022775" y2="127.17805383022775" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="258.2712215320911" y2="258.2712215320911" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="169.61283643892338" y2="169.61283643892338" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="258.2712215320911" y2="177.69565217391303" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><line y1="127.17805383022775" y2="153.82608695652172" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><rect y="153.82608695652172" x="43" width="13" height="23.86956521739131" style="stroke: rgb(255, 140, 0); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="43" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g></g><g class="bench" transform="translate(96,0)"><g class="sub"><line y1="186.28364389233957" y2="186.28364389233957" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="288.58178053830227" y2="288.58178053830227" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="249.68322981366458" y2="249.68322981366458" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="288.58178053830227" y2="250.94616977225675" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><line y1="186.28364389233957" y2="246.39958592132504" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><rect y="246.39958592132504" x="7" width="13" height="4.546583850931711" style="stroke: rgb(152, 171, 197); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="7" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="174.4120082815735" y2="174.4120082815735" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="291.10766045548655" y2="291.10766045548655" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="246.1469979296066" y2="246.1469979296066" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="291.10766045548655" y2="247.7888198757764" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><line y1="174.4120082815735" y2="241.2215320910973" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><rect y="241.2215320910973" x="25" width="13" height="6.56728778467911" style="stroke: rgb(107, 72, 107); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="25" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="65.29399585921325" y2="65.29399585921325" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="243.1159420289855" y2="243.1159420289855" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="124.14699792960664" y2="124.14699792960664" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="243.1159420289855" y2="125.6625258799172" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><line y1="65.29399585921325" y2="122.75776397515527" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><rect y="122.75776397515527" x="43" width="13" height="2.9047619047619264" style="stroke: rgb(255, 140, 0); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="43" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g></g><g class="bench" transform="translate(173,0)"><g class="sub"><line y1="229.47619047619048" y2="229.47619047619048" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="301.2111801242236" y2="301.2111801242236" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="240.46376811594203" y2="240.46376811594203" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="301.2111801242236" y2="241.09523809523807" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><line y1="229.47619047619048" y2="239.70600414078675" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><rect y="239.70600414078675" x="7" width="13" height="1.3892339544513277" style="stroke: rgb(152, 171, 197); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="7" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="227.8343685300207" y2="227.8343685300207" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="299.9482401656315" y2="299.9482401656315" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="236.16977225672878" y2="236.16977225672878" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="299.9482401656315" y2="236.92753623188406" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><line y1="227.8343685300207" y2="235.15942028985503" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><rect y="235.15942028985503" x="25" width="13" height="1.768115942029027" style="stroke: rgb(107, 72, 107); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="25" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="165.6977225672878" y2="165.6977225672878" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="293.63354037267084" y2="293.63354037267084" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="194.36645962732916" y2="194.36645962732916" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="293.63354037267084" y2="195.2505175983437" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><line y1="165.6977225672878" y2="193.10351966873708" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><rect y="193.10351966873708" x="43" width="13" height="2.146997929606613" style="stroke: rgb(255, 140, 0); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="43" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g></g><g class="bench" transform="translate(250,0)"><g class="sub"><line y1="227.45548654244308" y2="227.45548654244308" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="283.5300207039337" y2="283.5300207039337" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="255.11387163561076" y2="255.11387163561076" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="283.5300207039337" y2="257.3871635610766" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><line y1="227.45548654244308" y2="253.34575569358176" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><rect y="253.34575569358176" x="7" width="13" height="4.041407867494826" style="stroke: rgb(152, 171, 197); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="7" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="216.59420289855075" y2="216.59420289855075" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="291.10766045548655" y2="291.10766045548655" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="250.5672877846791" y2="250.5672877846791" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="291.10766045548655" y2="252.20910973084887" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><line y1="216.59420289855075" y2="247.28364389233957" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><rect y="247.28364389233957" x="25" width="13" height="4.925465838509297" style="stroke: rgb(107, 72, 107); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="25" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="143.46997929606627" y2="143.46997929606627" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="272.16356107660454" y2="272.16356107660454" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="209.14285714285714" y2="209.14285714285714" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="272.16356107660454" y2="210.2795031055901" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><line y1="143.46997929606627" y2="192.3457556935818" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><rect y="192.3457556935818" x="43" width="13" height="17.9337474120083" style="stroke: rgb(255, 140, 0); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="43" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g></g><g class="bench" transform="translate(327,0)"><g class="sub"><line y1="221.51966873706002" y2="221.51966873706002" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="301.2111801242236" y2="301.2111801242236" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="257.13457556935816" y2="257.13457556935816" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="301.2111801242236" y2="257.89233954451345" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><line y1="221.51966873706002" y2="255.87163561076605" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><rect y="255.87163561076605" x="7" width="13" height="2.0207039337473987" style="stroke: rgb(152, 171, 197); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="7" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="237.3064182194617" y2="237.3064182194617" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="299.9482401656315" y2="299.9482401656315" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="252.8405797101449" y2="252.8405797101449" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="299.9482401656315" y2="253.72463768115944" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><line y1="237.3064182194617" y2="251.19875776397518" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><rect y="251.19875776397518" x="25" width="13" height="2.5258799171842554" style="stroke: rgb(107, 72, 107); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="25" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="199.54451345755695" y2="199.54451345755695" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="292.37060041407864" y2="292.37060041407864" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="221.64596273291923" y2="221.64596273291923" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="292.37060041407864" y2="222.65631469979297" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><line y1="199.54451345755695" y2="219.8778467908903" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><rect y="219.8778467908903" x="43" width="13" height="2.778467908902684" style="stroke: rgb(255, 140, 0); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="43" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g></g><g class="bench" transform="translate(404,0)"><g class="sub"><line y1="228.97101449275362" y2="228.97101449275362" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="297.4223602484472" y2="297.4223602484472" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="270.52173913043475" y2="270.52173913043475" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="297.4223602484472" y2="271.4057971014493" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><line y1="228.97101449275362" y2="269.3850931677019" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><rect y="269.3850931677019" x="7" width="13" height="2.020703933747427" style="stroke: rgb(152, 171, 197); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="7" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="217.85714285714286" y2="217.85714285714286" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="296.15942028985506" y2="296.15942028985506" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="266.7329192546584" y2="266.7329192546584" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="296.15942028985506" y2="267.9958592132505" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><line y1="217.85714285714286" y2="262.43892339544516" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><rect y="262.43892339544516" x="25" width="13" height="5.556935817805368" style="stroke: rgb(107, 72, 107); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="25" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="91.05797101449276" y2="91.05797101449276" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="243.1159420289855" y2="243.1159420289855" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="205.48033126293996" y2="205.48033126293996" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="243.1159420289855" y2="207.75362318840578" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><line y1="91.05797101449276" y2="199.9233954451346" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><rect y="199.9233954451346" x="43" width="13" height="7.830227743271195" style="stroke: rgb(255, 140, 0); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="43" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g></g><g class="bench" transform="translate(481,0)"><g class="sub"><line y1="253.47204968944098" y2="253.47204968944098" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="298.68530020703935" y2="298.68530020703935" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="265.343685300207" y2="265.343685300207" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="298.68530020703935" y2="266.2277432712215" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><line y1="253.47204968944098" y2="264.5859213250518" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><rect y="264.5859213250518" x="7" width="13" height="1.6418219461697277" style="stroke: rgb(152, 171, 197); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="7" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="249.17805383022773" y2="249.17805383022773" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="297.4223602484472" y2="297.4223602484472" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="261.55486542443066" y2="261.55486542443066" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="297.4223602484472" y2="262.94409937888196" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><line y1="249.17805383022773" y2="258.77639751552795" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><rect y="258.77639751552795" x="25" width="13" height="4.1677018633540115" style="stroke: rgb(107, 72, 107); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="25" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="190.45134575569358" y2="190.45134575569358" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="289.8447204968944" y2="289.8447204968944" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="214.06832298136646" y2="214.06832298136646" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="289.8447204968944" y2="215.20496894409936" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><line y1="190.45134575569358" y2="212.5527950310559" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><rect y="212.5527950310559" x="43" width="13" height="2.6521739130434696" style="stroke: rgb(255, 140, 0); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="43" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g></g><g class="bench" transform="translate(558,0)"><g class="sub"><line y1="245.26293995859214" y2="245.26293995859214" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="294.8964803312629" y2="294.8964803312629" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="279.2360248447205" y2="279.2360248447205" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="294.8964803312629" y2="280.120082815735" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><line y1="245.26293995859214" y2="276.9627329192546" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><rect y="276.9627329192546" x="7" width="13" height="3.157349896480355" style="stroke: rgb(152, 171, 197); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="7" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="232.38095238095238" y2="232.38095238095238" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="296.15942028985506" y2="296.15942028985506" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="274.3105590062112" y2="274.3105590062112" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="296.15942028985506" y2="277.46790890269153" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><line y1="232.38095238095238" y2="268.879917184265" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><rect y="268.879917184265" x="25" width="13" height="8.587991718426508" style="stroke: rgb(107, 72, 107); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="25" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="93.83643892339548" y2="93.83643892339548" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="272.16356107660454" y2="272.16356107660454" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="218.4886128364389" y2="218.4886128364389" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="272.16356107660454" y2="219.62525879917186" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><line y1="93.83643892339548" y2="213.184265010352" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><rect y="213.184265010352" x="43" width="13" height="6.440993788819867" style="stroke: rgb(255, 140, 0); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="43" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g></g><g class="bench" transform="translate(635,0)"><g class="sub"><line y1="244.37888198757767" y2="244.37888198757767" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="299.9482401656315" y2="299.9482401656315" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="280.87784679089026" y2="280.87784679089026" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="299.9482401656315" y2="281.76190476190476" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><line y1="244.37888198757767" y2="278.60455486542446" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><rect y="278.60455486542446" x="7" width="13" height="3.157349896480298" style="stroke: rgb(152, 171, 197); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="7" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="239.57971014492753" y2="239.57971014492753" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="299.9482401656315" y2="299.9482401656315" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="277.3416149068323" y2="277.3416149068323" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="299.9482401656315" y2="278.60455486542446" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><line y1="239.57971014492753" y2="273.93167701863354" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><rect y="273.93167701863354" x="25" width="13" height="4.672877846790925" style="stroke: rgb(107, 72, 107); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="25" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="0" y2="0" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="286.055900621118" y2="286.055900621118" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="211.28985507246378" y2="211.28985507246378" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="286.055900621118" y2="213.43685300207042" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><line y1="0" y2="205.73291925465838" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><rect y="205.73291925465838" x="43" width="13" height="7.703933747412037" style="stroke: rgb(255, 140, 0); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="43" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g></g><g class="bench" transform="translate(712,0)"><g class="sub"><line y1="281.0041407867495" y2="281.0041407867495" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="302.4741200828157" y2="302.4741200828157" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="293.8861283643892" y2="293.8861283643892" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="302.4741200828157" y2="298.81159420289856" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><line y1="281.0041407867495" y2="292.74948240165634" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><rect y="292.74948240165634" x="7" width="13" height="6.062111801242224" style="stroke: rgb(152, 171, 197); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="7" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="275.69979296066253" y2="275.69979296066253" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="301.2111801242236" y2="301.2111801242236" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="291.10766045548655" y2="291.10766045548655" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="301.2111801242236" y2="293.5072463768116" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><line y1="275.69979296066253" y2="289.8447204968944" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><rect y="289.8447204968944" x="25" width="13" height="3.6625258799172116" style="stroke: rgb(107, 72, 107); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="25" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="209.14285714285714" y2="209.14285714285714" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="291.10766045548655" y2="291.10766045548655" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="263.57556935817803" y2="263.57556935817803" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="291.10766045548655" y2="264.5859213250518" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><line y1="209.14285714285714" y2="243.1159420289855" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><rect y="243.1159420289855" x="43" width="13" height="21.4699792960663" style="stroke: rgb(255, 140, 0); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="43" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g></g><g class="bench" transform="translate(789,0)"><g class="sub"><line y1="281.0041407867495" y2="281.0041407867495" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="302.4741200828157" y2="302.4741200828157" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="294.7701863354037" y2="294.7701863354037" x1="7" x2="20" style="stroke: rgb(152, 171, 197);"></line><line y1="302.4741200828157" y2="297.80124223602485" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><line y1="281.0041407867495" y2="291.360248447205" x1="13.5" x2="13.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><rect y="291.360248447205" x="7" width="13" height="6.440993788819867" style="stroke: rgb(152, 171, 197); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="7" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="275.1946169772257" y2="275.1946169772257" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="301.2111801242236" y2="301.2111801242236" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="291.86542443064184" y2="291.86542443064184" x1="25" x2="38" style="stroke: rgb(107, 72, 107);"></line><line y1="301.2111801242236" y2="295.52795031055905" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><line y1="275.1946169772257" y2="290.09730848861284" x1="31.5" x2="31.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><rect y="290.09730848861284" x="25" width="13" height="5.43064182194621" style="stroke: rgb(107, 72, 107); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="25" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="222.65631469979297" y2="222.65631469979297" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="297.4223602484472" y2="297.4223602484472" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="260.2919254658385" y2="260.2919254658385" x1="43" x2="56" style="stroke: rgb(255, 140, 0);"></line><line y1="297.4223602484472" y2="278.47826086956525" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><line y1="222.65631469979297" y2="243.36853002070393" x1="49.5" x2="49.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><rect y="243.36853002070393" x="43" width="13" height="35.10973084886132" style="stroke: rgb(255, 140, 0); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="43" width="13" style="fill: rgba(0, 0, 0, 0);"></rect></g></g><g class="focus" style="display: none;"><rect x="-65" width="59" y="0" height="18" fill="rgba(255, 255, 255, 0.9)"></rect><line x1="-6" x2="850" y1="0" y2="0" style="stroke-dasharray: 2, 2;"></line><text y="0" x="-9" text-anchor="end" alignment-baseline="middle"></text></g></g></svg></div><script> drawBars('#tcp_bars', TCP_DATA); drawLats('#tcp_lats', TCP_DATA); </script></div></div><div class="row"><div class="large-9 columns"><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">关于每个职位的一些评论:</font></font></p><ol><li><em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">ASYNCIO流</font></font></em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">。</font><font style="vertical-align: inherit;">asyncio及其内置的纯Python事件循环。</font><font style="vertical-align: inherit;">在此基准测试中,我们测试了高级流抽象的性能。</font><font style="vertical-align: inherit;">我们</font></font><code>asyncio.create_server()</code><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">用来创建将一对传递</font></font><code>(reader, writer)</code><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">给客户端协程的服务器。</font></font></li><li><em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">龙卷风</font></font></em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">。</font><font style="vertical-align: inherit;">该服务器实现了一个非常简单的Tornado协议,该协议会立即将收到的所有数据发送回去。</font></font></li><li><em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">古玩流</font></font></em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">。</font><font style="vertical-align: inherit;">Curio是Python aio lib块上的新手。</font><font style="vertical-align: inherit;">与</font></font><em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">asyncio-streams</font></font></em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">相似</font><font style="vertical-align: inherit;">,在此基准测试中,我们测试curio流,</font></font><code>curio.make_streams()</code><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">用于创建一对</font></font><code>(reader, writer)</code><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">提供高级API(例如)的流</font></font><code>readline()</code><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">。</font></font></li><li><em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">扭曲</font></font></em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">。</font><font style="vertical-align: inherit;">与龙卷风类似,这里我们测试最小回波协议。</font></font></li><li><em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">古玩</font></font></em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">。</font><font style="vertical-align: inherit;">此基准测试了古玩插槽的性能:</font></font><code>sock.recv()</code><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">和</font></font><code>sock.sendall()</code><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">协程</font><font style="vertical-align: inherit;">的紧密循环</font><font style="vertical-align: inherit;">。</font></font></li><li><em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">uvloop流</font></font></em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">。</font><font style="vertical-align: inherit;">与#2一样,这里我们测试asyncio高级流的性能,但是这次是在uvloop之上。</font></font></li><li><em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">gevent</font></font></em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">。</font><font style="vertical-align: inherit;">我们使用</font></font><code>gevent.StreamServer</code><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">gevent套接字在紧密的循环中发送/接收数据。</font></font></li><li><em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">ASYNCIO</font></font></em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">。</font><font style="vertical-align: inherit;">看来,香草异步反应相当快!</font><font style="vertical-align: inherit;">与#2和#4类似,这里我们测试在纯Python异步中实现的最小回显协议的性能。</font></font></li><li><em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">nodejs</font></font></em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">。</font><font style="vertical-align: inherit;">我们使用</font></font><code>net.createServer</code><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">API在nodejs v4.2.6中测试流的性能。</font></font></li><li><em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">uvloop</font></font></em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">。</font><font style="vertical-align: inherit;">此基准测试了在uvloop上以异步方式实现的最小回显协议(如#2,#4,#8)。</font><font style="vertical-align: inherit;">有了1 KiB消息,uvloop是最快的实现,每秒高达105,000个请求!</font><font style="vertical-align: inherit;">对于100 KiB消息,uvloop设法以大约2.3 GiB / s的速度运行。</font></font></li><li><em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">围棋</font></font></em><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">。</font></font><code>net.Conn.Read/Write</code><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">通话</font><font style="vertical-align: inherit;">紧密</font><font style="vertical-align: inherit;">。</font><font style="vertical-align: inherit;">Golang的性能与uvloop非常相似,对于10和100 KiB消息,性能稍好一些。</font></font></li></ol></div><div class="large-3 columns mb-sidebar"><p class="show-for-large"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"> 如何阅读箱形图: </font></font><svg height="200px" viewBox="-5 -5 90 300"><g><line x1="0" y1="10" stroke="#222" y2="10" x2="30"></line><line x1="15" y1="10" stroke="#222" stroke-dasharray="2,2" y2="100" x2="15"></line><rect x="0" stroke="#222" width="30" y="100" fill="#fff" height="90"></rect><line x1="0" y1="145" stroke="#222" y2="145" x2="30"></line><line x1="15" y1="190" stroke="#222" stroke-dasharray="2,2" y2="290" x2="15"></line><line x1="0" y1="290" stroke="#222" y2="290" x2="30"></line><text x="40" alignment-baseline="middle" y="10" font-family="sans-serif" fill="#222" font-size="14px">99%</text><text x="40" alignment-baseline="middle" y="100" font-family="sans-serif" fill="#222" font-size="14px">75%</text><text x="40" alignment-baseline="middle" y="145" font-family="sans-serif" fill="#222" font-size="14px">50%</text><text x="40" alignment-baseline="middle" y="190" font-family="sans-serif" fill="#222" font-size="14px">25%</text><text x="40" alignment-baseline="middle" y="290" font-family="sans-serif" fill="#222" font-size="14px">min</text></g></svg></p><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">所有基准的代码都可以在</font></font><a href="https://github.com/MagicStack/vmbench/tree/master/servers"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">这里</font></font></a><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">找到</font><font style="vertical-align: inherit;">。</font></font></p><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">另请参见UNIX套接字基准测试</font></font><a href="unix-bench.html"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">结果</font></font></a><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">。</font></font></p></div></div><div class="row"><div class="large-9 columns"><h3><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">HTTP</font></font></h3></div></div><div class="row"><div class="large-9 columns"><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">最初,我们想针对nodejs和Go在asyncio和uvloop上测试aiohttp。</font><font style="vertical-align: inherit;">aiohttp是使用asyncio编写异步HTTP服务器和客户端的最受欢迎的框架。</font></font></p></div><div class="large-3 columns mb-sidebar"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">另请参阅完整的HTTP基准测试</font></font><a href="http-bench.html"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">报告</font></font></a><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">。</font></font></div></div><div class="row"><div class="large-9 columns"><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">但是,aiohttp的性能瓶颈竟然是其HTTP解析器,它是如此之慢,以至于底层I / O库的速度有多快都没有关系。</font><font style="vertical-align: inherit;">为了使事情变得更有趣,我们为http-parser(最初为Nginx开发的nodejs HTTP解析器C库)创建了Python绑定。</font><font style="vertical-align: inherit;">该库称为</font></font><a href="https://github.com/MagicStack/httptools"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">httptools</font></font></a><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">,在Github和</font></font><a href="https://pypi.python.org/pypi/httptools"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">PyPI</font></font></a><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">上可用</font><font style="vertical-align: inherit;">。</font></font></p><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">对于HTTP,所有基准测试都使用</font></font><a href="https://github.com/wg/wrk"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">wrk</font></font></a><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">生成负载。</font><font style="vertical-align: inherit;">并发级别设置为300。每个基准测试的持续时间为30秒。</font></font></p></div><div class="large-3 columns mb-sidebar"><p><span></span></p></div></div><div class="row"><div class="large-12 columns"><div class="mb-charts"><svg id="http_bars" class="chart" style="width: 100%" viewBox="0 0 1000 370"><g transform="translate(65,10)"><g class="x axis" transform="translate(0,305)"><g class="tick" transform="translate(85,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">asyncio</text></g><g class="tick" transform="translate(225,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">uvloop</text></g><g class="tick" transform="translate(365,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">nodejs</text></g><g class="tick" transform="translate(505,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">asyncio</text></g><g class="tick" transform="translate(645,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">golang</text></g><g class="tick" transform="translate(785,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">uvloop</text></g><path class="domain" d="M0,6V0H870V6"></path></g><g class="x axis x2" transform="translate(0,319)"><g class="tick" transform="translate(85,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">aiohttp</text></g><g class="tick" transform="translate(225,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">aiohttp</text></g><g class="tick" transform="translate(365,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(505,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">httptools</text></g><g class="tick" transform="translate(645,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(785,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">httptools</text></g><path class="domain" d="M0,6V0H870V6"></path></g><g class="y axis"><g class="tick" transform="translate(0,305)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">0</text></g><g class="tick" transform="translate(0,266.2649225298451)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">5,000</text></g><g class="tick" transform="translate(0,227.52984505969013)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">10,000</text></g><g class="tick" transform="translate(0,188.79476758953518)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">15,000</text></g><g class="tick" transform="translate(0,150.05969011938026)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">20,000</text></g><g class="tick" transform="translate(0,111.32461264922529)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">25,000</text></g><g class="tick" transform="translate(0,72.58953517907037)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">30,000</text></g><g class="tick" transform="translate(0,33.85445770891543)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">35,000</text></g><path class="domain" d="M-6,0H0V305H-6"></path><text transform="rotate(-90)" y="6" dy=".71em" style="text-anchor: end;">Requests / sec</text></g><g class="legend" transform="translate(870, 20)"><circle cx="0" cy="0" r="5" style="fill: rgb(152, 171, 197);"></circle><text x="7" y="0" alignment-baseline="central">1 KiB</text></g><g class="legend" transform="translate(870, 20)"><circle cx="0" cy="20" r="5" style="fill: rgb(107, 72, 107);"></circle><text x="7" y="20" alignment-baseline="central">10 KiB</text></g><g class="legend" transform="translate(870, 20)"><circle cx="0" cy="40" r="5" style="fill: rgb(255, 140, 0);"></circle><text x="7" y="40" alignment-baseline="central">100 KiB</text></g><g class="bench" transform="translate(29,0)"><rect width="28" x="7" y="279.7814503429007" height="25.218549657099288" style="fill: rgb(152, 171, 197);"></rect><rect width="28" x="42" y="281.1667716535433" height="23.83322834645668" style="fill: rgb(107, 72, 107);"></rect><rect width="28" x="77" y="281.8327051054102" height="23.167294894589816" style="fill: rgb(255, 140, 0);"></rect></g><g class="bench" transform="translate(169,0)"><rect width="28" x="7" y="278.3458509017018" height="26.654149098298205" style="fill: rgb(152, 171, 197);"></rect><rect width="28" x="42" y="279.72807340614685" height="25.271926593853152" style="fill: rgb(107, 72, 107);"></rect><rect width="28" x="77" y="280.33203073406145" height="24.667969265938552" style="fill: rgb(255, 140, 0);"></rect></g><g class="bench" transform="translate(309,0)"><rect width="28" x="7" y="148.89601092202184" height="156.10398907797816" style="fill: rgb(152, 171, 197);"></rect><rect width="28" x="42" y="205.6691617983236" height="99.33083820167641" style="fill: rgb(107, 72, 107);"></rect><rect width="28" x="77" y="277.5572821945644" height="27.44271780543562" style="fill: rgb(255, 140, 0);"></rect></g><g class="bench" transform="translate(449,0)"><rect width="28" x="7" y="111.63061976123952" height="193.36938023876047" style="fill: rgb(152, 171, 197);"></rect><rect width="28" x="42" y="139.63484124968252" height="165.36515875031748" style="fill: rgb(107, 72, 107);"></rect><rect width="28" x="77" y="181.6625552451105" height="123.3374447548895" style="fill: rgb(255, 140, 0);"></rect></g><g class="bench" transform="translate(589,0)"><rect width="28" x="7" y="0" height="305" style="fill: rgb(152, 171, 197);"></rect><rect width="28" x="42" y="145.94036957073916" height="159.05963042926084" style="fill: rgb(107, 72, 107);"></rect><rect width="28" x="77" y="167.6664097028194" height="137.3335902971806" style="fill: rgb(255, 140, 0);"></rect></g><g class="bench" transform="translate(729,0)"><rect width="28" x="7" y="11.649342138684291" height="293.3506578613157" style="fill: rgb(152, 171, 197);"></rect><rect width="28" x="42" y="69.48360172720348" height="235.51639827279652" style="fill: rgb(107, 72, 107);"></rect><rect width="28" x="77" y="146.37273050546102" height="158.62726949453898" style="fill: rgb(255, 140, 0);"></rect></g><g class="focus" style="display: none;"><rect x="-65" width="59" y="0" height="18" fill="rgba(255, 255, 255, 0.9)"></rect><line x1="-6" x2="850" y1="0" y2="0" style="stroke-dasharray: 2, 2;"></line><text y="0" x="-9" text-anchor="end" alignment-baseline="middle"></text></g></g></svg><svg id="http_lats" class="chart" style="width: 100%" viewBox="0 0 1000 370"><g transform="translate(65,10)"><g class="x axis" transform="translate(0,305)"><g class="tick" transform="translate(85,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">asyncio</text></g><g class="tick" transform="translate(225,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">uvloop</text></g><g class="tick" transform="translate(365,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">nodejs</text></g><g class="tick" transform="translate(505,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">asyncio</text></g><g class="tick" transform="translate(645,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">golang</text></g><g class="tick" transform="translate(785,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">uvloop</text></g><path class="domain" d="M0,6V0H870V6"></path></g><g class="x axis x2" transform="translate(0,319)"><g class="tick" transform="translate(85,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">aiohttp</text></g><g class="tick" transform="translate(225,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">aiohttp</text></g><g class="tick" transform="translate(365,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(505,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">httptools</text></g><g class="tick" transform="translate(645,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;"></text></g><g class="tick" transform="translate(785,0)" style="opacity: 1;"><line y2="6" x2="0"></line><text dy=".71em" y="9" x="0" style="text-anchor: middle;">httptools</text></g><path class="domain" d="M0,6V0H870V6"></path></g><g class="y axis"><g class="tick" transform="translate(0,305)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">0</text></g><g class="tick" transform="translate(0,280.7107589392371)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">10</text></g><g class="tick" transform="translate(0,256.42151787847416)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">20</text></g><g class="tick" transform="translate(0,232.13227681771124)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">30</text></g><g class="tick" transform="translate(0,207.84303575694832)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">40</text></g><g class="tick" transform="translate(0,183.55379469618538)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">50</text></g><g class="tick" transform="translate(0,159.26455363542246)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">60</text></g><g class="tick" transform="translate(0,134.97531257465954)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">70</text></g><g class="tick" transform="translate(0,110.68607151389662)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">80</text></g><g class="tick" transform="translate(0,86.39683045313372)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">90</text></g><g class="tick" transform="translate(0,62.10758939237076)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">100</text></g><g class="tick" transform="translate(0,37.818348331607844)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">110</text></g><g class="tick" transform="translate(0,13.529107270844925)" style="opacity: 1;"><line x2="-6" y2="0"></line><text dy=".32em" x="-9" y="0" style="text-anchor: end;">120</text></g><path class="domain" d="M-6,0H0V305H-6"></path><text transform="rotate(-90)" y="6" dy=".71em" style="text-anchor: end;">Latency (msec)</text></g><g class="legend" transform="translate(870, 20)"><circle cx="0" cy="0" r="5" style="fill: rgb(152, 171, 197);"></circle><text x="7" y="0" alignment-baseline="central">1 KiB</text></g><g class="legend" transform="translate(870, 20)"><circle cx="0" cy="20" r="5" style="fill: rgb(107, 72, 107);"></circle><text x="7" y="20" alignment-baseline="central">10 KiB</text></g><g class="legend" transform="translate(870, 20)"><circle cx="0" cy="40" r="5" style="fill: rgb(255, 140, 0);"></circle><text x="7" y="40" alignment-baseline="central">100 KiB</text></g><g class="bench" transform="translate(29,0)"><g class="sub"><line y1="0" y2="0" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="217.7724775025882" y2="217.7724775025882" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="84.65529186907699" y2="84.65529186907699" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="217.7724775025882" y2="85.44226327944573" x1="22.5" x2="22.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><line y1="0" y2="83.87317830692042" x1="22.5" x2="22.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><rect y="83.87317830692042" x="11" width="23" height="1.569084972525303" style="stroke: rgb(152, 171, 197); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="11" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="17.143346340686463" y2="17.143346340686463" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="172.61634944652383" y2="172.61634944652383" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="69.83642589790554" y2="69.83642589790554" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="172.61634944652383" y2="70.47523293780358" x1="55.5" x2="55.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><line y1="17.143346340686463" y2="69.22676594728038" x1="55.5" x2="55.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><rect y="69.22676594728038" x="44" width="23" height="1.2484669905231982" style="stroke: rgb(107, 72, 107); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="44" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="59.05200286692683" y2="59.05200286692683" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="173.0535557856176" y2="173.0535557856176" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="62.811977383132906" y2="62.811977383132906" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="173.0535557856176" y2="63.902564306761164" x1="88.5" x2="88.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><line y1="59.05200286692683" y2="62.090586923628244" x1="88.5" x2="88.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><rect y="62.090586923628244" x="77" width="23" height="1.8119773831329198" style="stroke: rgb(255, 140, 0); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="77" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g></g><g class="bench" transform="translate(169,0)"><g class="sub"><line y1="18.83144859440948" y2="18.83144859440948" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="99.57374372859756" y2="99.57374372859756" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="95.80162459186111" y2="95.80162459186111" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="99.57374372859756" y2="96.27769371665207" x1="22.5" x2="22.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><line y1="18.83144859440948" y2="95.10695229752328" x1="22.5" x2="22.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><rect y="95.10695229752328" x="11" width="23" height="1.1707414191287882" style="stroke: rgb(152, 171, 197); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="11" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="68.32320617981999" y2="68.32320617981999" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="84.63343155212232" y2="84.63343155212232" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="82.44497093254759" y2="82.44497093254759" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="84.63343155212232" y2="82.92104005733853" x1="55.5" x2="55.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><line y1="68.32320617981999" y2="81.87174484351355" x1="55.5" x2="55.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><rect y="81.87174484351355" x="44" width="23" height="1.0492952138249763" style="stroke: rgb(107, 72, 107); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="44" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="62.770685673329595" y2="62.770685673329595" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="79.62013219718082" y2="79.62013219718082" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="76.9604603010273" y2="76.9604603010273" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="79.62013219718082" y2="78.05833399697377" x1="88.5" x2="88.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><line y1="62.770685673329595" y2="76.17591781476465" x1="88.5" x2="88.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><rect y="76.17591781476465" x="77" width="23" height="1.882416182209127" style="stroke: rgb(255, 140, 0); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="77" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g></g><g class="bench" transform="translate(309,0)"><g class="sub"><line y1="267.52898781556104" y2="267.52898781556104" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="269.90204666719757" y2="269.90204666719757" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="269.022776140798" y2="269.022776140798" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="269.90204666719757" y2="269.1490801943139" x1="22.5" x2="22.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><line y1="267.52898781556104" y2="268.8551803774787" x1="22.5" x2="22.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><rect y="268.8551803774787" x="11" width="23" height="0.2938998168352214" style="stroke: rgb(152, 171, 197); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="11" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="245.8119773831329" y2="245.8119773831329" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="249.19303973879113" y2="249.19303973879113" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="248.71697061400013" y2="248.71697061400013" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="249.19303973879113" y2="248.8578482121526" x1="55.5" x2="55.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><line y1="245.8119773831329" y2="247.502508560962" x1="55.5" x2="55.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><rect y="247.502508560962" x="44" width="23" height="1.355339651190576" style="stroke: rgb(107, 72, 107); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="44" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="83.07649120012738" y2="83.07649120012738" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="101.82535637493031" y2="101.82535637493031" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="101.17683363860793" y2="101.17683363860793" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="101.82535637493031" y2="101.3249980090786" x1="88.5" x2="88.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><line y1="83.07649120012738" y2="100.86107350481801" x1="88.5" x2="88.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><rect y="100.86107350481801" x="77" width="23" height="0.4639245042605893" style="stroke: rgb(255, 140, 0); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="77" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g></g><g class="bench" transform="translate(449,0)"><g class="sub"><line y1="265.44982878075973" y2="265.44982878075973" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="285.39129569164606" y2="285.39129569164606" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="276.02050649040376" y2="276.02050649040376" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="285.39129569164606" y2="276.0885163653739" x1="22.5" x2="22.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><line y1="265.44982878075973" y2="275.95006769132755" x1="22.5" x2="22.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><rect y="275.95006769132755" x="11" width="23" height="0.13844867404634442" style="stroke: rgb(152, 171, 197); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="11" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="260.6381301266226" y2="260.6381301266226" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="278.94250219001356" y2="278.94250219001356" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="271.23795492553955" y2="271.23795492553955" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="278.94250219001356" y2="271.33996973799475" x1="55.5" x2="55.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><line y1="260.6381301266226" y2="271.15294258182684" x1="55.5" x2="55.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><rect y="271.15294258182684" x="44" width="23" height="0.18702715616791465" style="stroke: rgb(107, 72, 107); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="44" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="248.8457035916222" y2="248.8457035916222" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="263.0767699291232" y2="263.0767699291232" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="259.4698176315999" y2="259.4698176315999" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="263.0767699291232" y2="259.8074380823445" x1="88.5" x2="88.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><line y1="248.8457035916222" y2="259.32165326112926" x1="88.5" x2="88.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><rect y="259.32165326112926" x="77" width="23" height="0.4857848212152476" style="stroke: rgb(255, 140, 0); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="77" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g></g><g class="bench" transform="translate(589,0)"><g class="sub"><line y1="270.3805447160946" y2="270.3805447160946" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="304.9271322768177" y2="304.9271322768177" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="286.81950306601897" y2="286.81950306601897" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="304.9271322768177" y2="291.00939714900056" x1="22.5" x2="22.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><line y1="270.3805447160946" y2="282.6150354384009" x1="22.5" x2="22.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><rect y="282.6150354384009" x="11" width="23" height="8.39436171059964" style="stroke: rgb(152, 171, 197); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="11" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="247.03858405670144" y2="247.03858405670144" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="304.8761248705901" y2="304.8761248705901" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="269.47698494863425" y2="269.47698494863425" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="304.8761248705901" y2="277.3904196862308" x1="55.5" x2="55.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><line y1="247.03858405670144" y2="262.0493350322529" x1="55.5" x2="55.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><rect y="262.0493350322529" x="44" width="23" height="15.34108465397793" style="stroke: rgb(107, 72, 107); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="44" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="238.41833240423668" y2="238.41833240423668" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="304.7571075893924" y2="304.7571075893924" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="264.01433463406863" y2="264.01433463406863" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="304.7571075893924" y2="272.9673488890659" x1="88.5" x2="88.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><line y1="238.41833240423668" y2="255.4037986780282" x1="88.5" x2="88.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><rect y="255.4037986780282" x="77" width="23" height="17.563550211037665" style="stroke: rgb(255, 140, 0); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="77" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g></g><g class="bench" transform="translate(729,0)"><g class="sub"><line y1="275.4448514772637" y2="275.4448514772637" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="296.0979931512304" y2="296.0979931512304" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="286.0471052002867" y2="286.0471052002867" x1="11" x2="34" style="stroke: rgb(152, 171, 197);"></line><line y1="296.0979931512304" y2="286.1151150752568" x1="22.5" x2="22.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><line y1="275.4448514772637" y2="285.98395317352873" x1="22.5" x2="22.5" style="stroke: rgb(152, 171, 197); stroke-dasharray: 2, 2;"></line><rect y="285.98395317352873" x="11" width="23" height="0.13116190172809183" style="stroke: rgb(152, 171, 197); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="11" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="270.6501552918691" y2="270.6501552918691" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="287.2057019988851" y2="287.2057019988851" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="281.4855857290754" y2="281.4855857290754" x1="44" x2="67" style="stroke: rgb(107, 72, 107);"></line><line y1="287.2057019988851" y2="281.5268774388787" x1="55.5" x2="55.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><line y1="270.6501552918691" y2="281.4175758541053" x1="55.5" x2="55.5" style="stroke: rgb(107, 72, 107); stroke-dasharray: 2, 2;"></line><rect y="281.4175758541053" x="44" width="23" height="0.10930158477344776" style="stroke: rgb(107, 72, 107); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="44" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g><g class="sub"><line y1="259.6592737118739" y2="259.6592737118739" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="271.5731464521781" y2="271.5731464521781" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="269.6640121048021" y2="269.6640121048021" x1="77" x2="100" style="stroke: rgb(255, 140, 0);"></line><line y1="271.5731464521781" y2="269.7271641315601" x1="88.5" x2="88.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><line y1="259.6592737118739" y2="269.58871545751373" x1="88.5" x2="88.5" style="stroke: rgb(255, 140, 0); stroke-dasharray: 2, 2;"></line><rect y="269.58871545751373" x="77" width="23" height="0.13844867404634442" style="stroke: rgb(255, 140, 0); fill: rgba(0, 0, 0, 0);"></rect><rect y="0" height="305" x="77" width="23" style="fill: rgba(0, 0, 0, 0);"></rect></g></g><g class="focus" style="display: none;"><rect x="-65" width="59" y="260.47698494863425" height="18" fill="rgba(255, 255, 255, 0.9)"></rect><line x1="-6" x2="850" y1="269.47698494863425" y2="269.47698494863425" style="stroke-dasharray: 2, 2;"></line><text y="269.47698494863425" x="-9" text-anchor="end" alignment-baseline="middle">14.63</text></g></g></svg></div><script> drawBars('#http_bars', HTTP_DATA); drawLats('#http_lats', HTTP_DATA); </script></div></div><div class="row"><div class="large-9 columns"><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"> 出乎意料的是,借助高性能HTTP解析器,纯Python异步比使用相同HTTP解析器的nodejs更快! </font></font></p><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">Go对于1 KiB响应更快,但是uvloop + asyncio对于10/100 KiB响应明显更好。</font><font style="vertical-align: inherit;">服务质量对于使用httptools的asyncio和uvloop以及Go来说都是极好的。</font></font></p><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">诚然,与其他实现不同,基于httptools的服务器非常小,并且不包含任何路由逻辑。</font><font style="vertical-align: inherit;">但是,该基准测试表明了使用有效实施的协议可以实现多快的uvloop。</font></font></p></div></div><div class="row"><div class="large-9 columns"><h2><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">结论</font></font></h2><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">可以肯定地得出结论,使用uvloop,可以编写Python网络代码,每个CPU内核每秒可以推送成千上万的请求。</font><font style="vertical-align: inherit;">在多核系统上,可以使用进程池进一步扩展性能。</font></font></p><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">uvloop和asyncio,再加上</font><font style="vertical-align: inherit;">Python 3.5 </font><font style="vertical-align: inherit;">中</font></font><a href="https://www.python.org/dev/peps/pep-0492/"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">async / await</font></font></a><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">的强大功能</font><font style="vertical-align: inherit;">,使使用Python编写高性能网络代码比以往任何时候都更加容易。</font></font></p><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">请尝试uvloop(</font></font><a href="https://github.com/magicstack/uvloop"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">github</font></font></a><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">)并与我们分享您的结果!</font></font></p></div></div></section></article> <footer class="m-footer"><div class="row"><div class="medium-6 columns"><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">©2016 MagicStack Inc. </font></font></p><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">302-639 Queen Street West </font></font><br><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">Toronto,ON,M5V 2B7 </font></font><br><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">加拿大</font></font></p></div><div class="medium-6 columns medium-text-right"><p><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">找工作?</font></font><br><a href="mailto:hello@magic.io"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">向我们介绍你自己!</font></font></a></p></div></div></footer> <script async="" defer="" id="github-bjs" src="https://buttons.github.io/buttons.js"></script><div id="goog-gt-tt" class="skiptranslate" dir="ltr"><div style="padding: 8px;"><div><div class="logo"><img src="https://www.gstatic.com/images/branding/product/1x/translate_24dp.png" width="20" height="20" alt="Google 翻译"></div></div></div><div class="top" style="padding: 8px; float: left; width: 100%;"><h1 class="title gray">原文</h1></div><div class="middle" style="padding: 8px;"><div class="original-text"></div></div><div class="bottom" style="padding: 8px;"><div class="activity-links"><span class="activity-link">提供更好的翻译建议</span><span class="activity-link"></span></div><div class="started-activity-container"><hr style="color: #CCC; background-color: #CCC; height: 1px; border: none;"><div class="activity-root"></div></div></div><div class="status-message" style="display: none;"></div></div>
<div class="goog-te-spinner-pos"><div class="goog-te-spinner-animation"><svg xmlns="http://www.w3.org/2000/svg" class="goog-te-spinner" width="96px" height="96px" viewBox="0 0 66 66"><circle class="goog-te-spinner-path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle></svg></div></div></body>