@Itamar - Thanks for that. Didn't know deferToThread uses a threadpool.<div><br></div><div>@Jean-Paul - Wow thanks, looks interesting..will definitely take a look.</div><div><br></div><div>Thanks again guys.</div><div>
<br></div><div>Arun<br><br><div class="gmail_quote">On Mon, May 18, 2009 at 9:21 PM, Jean-Paul Calderone <span dir="ltr"><<a href="mailto:exarkun@divmod.com">exarkun@divmod.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Mon, 18 May 2009 08:31:56 -0400, Itamar Shtull-Trauring <<a href="mailto:itamar@itamarst.org">itamar@itamarst.org</a>> wrote:<br>
>On Mon, 2009-05-18 at 19:34 +0800, Arun Thampi wrote:<br>
>> Hi guys - I'm just beginning to learn about Twisted and was wondering<br>
>> if there is a way to use the built-in Twisted persistence libraries<br>
>> such as dirdbm etc. without blocking the main event loop? I read about<br>
>> an approach which uses deferToThread (comment#3<br>
>> here: <a href="http://code.activestate.com/recipes/413609/" target="_blank">http://code.activestate.com/recipes/413609/</a>) but if you are<br>
>> persisting quite often, doesn't the creation of threads on every<br>
>> persist-call make it very expensive?<br>
><br>
>deferToThread uses a threadpool, so it's not *very* slow. It does slow<br>
>things down a bit, so it's better to do chunks of work rather than doing<br>
>writes separately. That being said, writing to disk in main eventloop is<br>
>often fast enough in practice, depending on how strong your latency<br>
>guarantees need to be.<br>
><br>
<br>
</div>More importantly, don't use dirdbm. It's not a reliable data storage<br>
library. In fact, you probably shouldn't use anything in twisted.persisted.<br>
<br>
You might be interested in <<a href="http://www.divmod.org/trac/wiki/DivmodAxiom" target="_blank">http://www.divmod.org/trac/wiki/DivmodAxiom</a>>.<br>
<font color="#888888"><br>
Jean-Paul<br>
</font><div><div></div><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><br clear="all"><br>-- <br>It's better to be a pirate than join the Navy - Steve Jobs<br><a href="http://arunthampi.wordpress.com">http://arunthampi.wordpress.com</a><br>
</div>