<div class="gmail_quote">On Tue, Oct 6, 2009 at 10:40 PM, Steve Steiner (listsin) <span dir="ltr">&lt;<a href="mailto:listsin@integrateddevcorp.com">listsin@integrateddevcorp.com</a>&gt;</span> wrote:<br><div> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
       Should I limit the number of &quot;in-flight&quot; pages?<br></blockquote><div><br>I&#39;m not going to comment on that, because I don&#39;t know what your app is doing or why it appears to be dying.  As you said, you didn&#39;t post code :).<br>
<br>However, you can experiment with it pretty easily using DeferredSemaphore: <a href="http://twistedmatrix.com/documents/8.2.0/api/twisted.internet.defer.DeferredSemaphore.html">http://twistedmatrix.com/documents/8.2.0/api/twisted.internet.defer.DeferredSemaphore.html</a><br>
 </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
        Currently, I&#39;m scanning sites that have upwards of 5000 pages and it<br>
seems that, when I get too many deferred&#39;s in flight, the app<br>
*appears* to crash.<br>
<br>
        I&#39;m not sure whether it&#39;s actually going out to lunch or just appears<br>
that way and, before I go instrumenting the app to death, can anyone<br>
tell me whether there is some sort of practical limit to how many &quot;in-<br>
flight&quot; deferreds might start to cause issues, just due to the sheer<br>
number?<br></blockquote><div><br>If your app is doing something strange that you don&#39;t understand, you should instrument it until you understand it.  Regardless of any practical advice you may receive as a temporary stopgap, there&#39;s always a chance that something <i>else</i> is going wrong, and by reducing the number of concurrent requests you&#39;re just decreasing its likelihood rather than properly fixing it.<br>
<br>It&#39;s highly unlikely that it&#39;s actually the number of Deferreds.  A Deferred is just a Python object, so if you&#39;ve got the RAM to store them and their associated callbacks, you should be fine.  It&#39;s more likely that it has something to do with long callback chains, or hitting some kind of file-descriptor limit (what version of Twisted are you using?) or perhaps that 5000 pages is just a lot of pages to request and you might need to wait a while.<br>
<br>Good luck,<br><br>-Glyph<br></div></div>