The background:<div><br></div><div>I&#39;ve been using DeferredSemaphore and DeferredList to manage the running of tasks with a resource constraint (only so many tasks can run at the same time).  This worked great until I tried to use it to manage millions of tasks.  Simply setting them up to run (DeferredSemaphore.run() calls) took appx. 2 hours and used ~5 gigs of ram.  This was less efficient than I expected.  Note that these numbers don&#39;t include time/memory for actually running the tasks, only time/memory to set up the running of the tasks.  I&#39;ve since written a custom task runner that has uses comparatively little setup time/memory by adding a &quot;manager&quot; callback to each task which starts additional tasks as appropriate.
<div><br></div><div>My questions:</div><div><ul><li>Is the behavior I&#39;m seeing expected?  i.e. are DS/DL only recommended for task management if the # of tasks not too large?  Is there a better way to use DS/DL that I might not be thinking of?</li>

<li>Is there a Twisted pattern for managing tasks efficiently that I might be missing?</li></ul><div>Thanks,</div></div><div><br></div><div>Jason</div><div><br></div></div>