<br><div class="gmail_quote">On Fri, Sep 11, 2009 at 10:32 PM, Anand Chitipothu <span dir="ltr">&lt;<a href="mailto:anandology@gmail.com">anandology@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im">2009/9/11 Dhananjay Nene &lt;<a href="mailto:dhananjay.nene@gmail.com">dhananjay.nene@gmail.com</a>&gt;:<br>
</div><div class="im">&gt; I am curious about the objective .. to the best of my knowledge wsgi is<br>
&gt; essentially blocking (unless my understanding is incorrect), whereas tornado<br>
&gt; is primarily non-blocking. So would you see any specific advantages of<br>
&gt; deploying a wsgi app with tornado ?<br>
<br>
</div>yes. quite a lot. In a multi-threaded server, as your concurrency<br>
increases thread context-switching overhead will become very high.<br>
Since Tornado uses epoll + callbacks it can handle thousands of<br>
requests.<br>
<br>
Performance Results for helloworld:<br>
<br>
tornado: 1414 req/sec<br>
tornado + web.py: 802 req/sec<br>
lighttpd + fastcgi + web.py: 354 req/sec<br>
<br>
Tests were run using: ab -n 1000 -c 25 &#39;<a href="http://0.0.0.0:8080/" target="_blank">http://0.0.0.0:8080/</a>&#39;<br>
<div><div></div><div class="h5"><br>
Anand<br></div></div></blockquote><div><br></div><div>The results look good Anand. Although I would argue that using a helloworld page is a little dubious here - it favors the epoll server. A good test will be taking a more complicated page which involves quite a bit of processing. With an epoll server, you would have to process each request extremely quickly, be careful not to do any other blocking I/O (your DB client, memcached client, etc should be non-blocking as well). If your callbacks are not quick enough, you won&#39;t be processing events as fast as you would like to and throughput will go down. This is why I think people resort to spawning a few threads even with an epoll server instead of a single thread (memcached also does the same in more recent versions again thanks to facebook&#39;s contributions IIRC).</div>

</div><br>-- <br>Harish Mallipeddi<br><a href="http://blog.poundbang.in">http://blog.poundbang.in</a><br>