<br><br><div class="gmail_quote">On Wed, Jul 11, 2012 at 2:08 AM, Werner Thie <span dir="ltr">&lt;<a href="mailto:werner@thieprojects.ch" target="_blank">werner@thieprojects.ch</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="HOEnZb"><div class="h5">On 7/10/12 6:17 AM, Laurens Van Houtven wrote:<br>
&gt; FWIW,  I have used Ampoule to great effect, but as JP points out it&#39;s hardly the only option. You&#39;re bound to end up with some measure of multiprocessing. Bear in mind that not all workloads are well-suited for this kind of problem! Always measure before deciding to make your codebase that much more complicated :)<br>

&gt;<br>
&gt;<br>
&gt; cheers<br>
&gt; lvh<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On 10 Jul 2012, at 18:03, <a href="mailto:exarkun@twistedmatrix.com">exarkun@twistedmatrix.com</a> wrote:<br>
&gt;<br>
&gt;&gt; On 03:14 pm, <a href="mailto:augustocaringi@gmail.com">augustocaringi@gmail.com</a> wrote:<br>
&gt;&gt;&gt; Hi,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    I&#39;m researching the best way to implement/use a Twisted-based<br>
&gt;&gt;&gt; server in a multicore environment...<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    There is the Ampoule project, that I realize is considered the<br>
&gt;&gt;&gt; best way to do that. Right?<br>
&gt;&gt;<br>
&gt;&gt; It&#39;s a way.  &quot;Best&quot; depends on the details and goals of the project.<br>
&gt;&gt;<br>
&gt;&gt; Here&#39;s a stackoverflow question/answer on basically the same topic.  In<br>
&gt;&gt; particular, it specifically answers the question of a listening port<br>
&gt;&gt; shared between multiple processes and gives examples of how to do this:<br>
&gt;&gt;<br>
&gt;&gt;   <a href="http://bit.ly/MiCHtQ" target="_blank">http://bit.ly/MiCHtQ</a><br>
&gt;&gt;<br>
&gt;&gt; Jean-Paul<br>
&gt;&gt;&gt;    I&#39;m also reading about the internals of Nginx HTTP server. This<br>
&gt;&gt;&gt; server utilizes the same reactor pattern of Twisted (epoll based)...<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    &quot;What resulted is a modular, event-driven, asynchronous,<br>
&gt;&gt;&gt; single-threaded, non-blocking architecture which became the foundation<br>
&gt;&gt;&gt; of nginx code.&quot; <a href="http://www.aosabook.org/en/nginx.html" target="_blank">http://www.aosabook.org/en/nginx.html</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    But to maximize the use of processors in a multicore environment,<br>
&gt;&gt;&gt; Nginx do this:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    &quot;nginx doesn&#39;t spawn a process or thread for every connection.<br>
&gt;&gt;&gt; Instead, worker processes accept new requests from a shared &quot;listen&quot;<br>
&gt;&gt;&gt; socket and execute a highly efficient run-loop inside each worker to<br>
&gt;&gt;&gt; process thousands of connections per worker&quot;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    My question: There is something similar in Twisted? Or do you<br>
&gt;&gt;&gt; think that is easy to implement something like that?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    Thanks!<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; --<br>
&gt;&gt;&gt; Augusto Mecking Caringi<br>
</div></div>We observed really great scaling on multi cores with moving the<br>
application part either to ampoule for PDF production or in the other<br>
case I wrote an implementation of self regulating process pool based on<br>
spread, leaving only the serving to twisted in both cases.<br>
<br>
With handing work out to other processes you get another benefit which<br>
is isolation of python, which is the only way to use a package, like<br>
reportlab which survives no sort of reentrancy, for a webservice.<br>
<span class="HOEnZb"><font color="#888888"><br>
Werner<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</div></div></blockquote></div><br>Hi Werner<br><br>       I want to know whether you have experienced any serious bug with ampoule? What version of ampoule did you use? Is it 0.2.0? Thanks.<br><br>Regards<br><br>gelin yan<br>