<br><br><div class="gmail_quote">On Sun, May 29, 2011 at 2:19 PM, Levente Uzonyi <span dir="ltr">&lt;<a href="mailto:leves@elte.hu">leves@elte.hu</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">On Sun, 29 May 2011, Mariano Martinez Peck wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Sun, May 29, 2011 at 4:06 AM, Levente Uzonyi &lt;<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>&gt; wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Sat, 28 May 2011, Mariano Martinez Peck wrote:<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 What are the errors that I must avoid making ?<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
</blockquote>
<br>
AFAIK SqueakDBX uses FFI which to my understanding means that it calls<br>
block the entire VM. That reduces the amount of concurrency a single<br>
image can handle. It also makes a connection pool more important.<br>
<br>
<br>
 Yes, FFI blocks the whole VM while a functions is being called. However,<br>
</blockquote>
if<br>
and only if the database client library supports asynchronous queries,<br>
SqueakDBX will work asynchronously. Basically, we do a loop where we ask<br>
the<br>
backend if the query was ready. If it was not, we do a yield (we let other<br>
process of the image to run) and then continue the loop.<br>
<br>
</blockquote>
<br>
FYI: The expression &quot;Processor yield&quot; doesn&#39;t let all processes run, just<br>
those which have the same priority. So using it in a loop starves all lower<br>
priority processes and results in busy waiting.<br>
<br>
<br>
</blockquote>
Thanks.  I was not clear. What we actually do is:<br>
<br>
   (code = OpenDBX resultTimeout) ifTrue: [ (Delay forMilliseconds:<br>
(aQuerySettings timeout asMiliseconds)) wait  ].<br>
<br>
Is that better?  Even if it lets just run processes of the same priority,<br>
this is good anyway because what we want is at least be able to process<br>
other queries. Probably, those other processes are being done from other<br>
Process.<br>
</blockquote>
<br></div>
It&#39;s a bit better. There&#39;s no starvation if the timeout is greater than zero, but it&#39;s still a form of busy waiting, and it limits the number of queries per second per connection to at most 1000 (actually 1000 / timeout). To compare this with our native implementation - PostgresV3 - I measured 6k+ queries per second per connection and it&#39;s still not optimized for Cog (#perform: is slow on Cog).<br>
<font color="#888888">
<br></font></blockquote><div><br>Thanks Levente. Unfortunatly I guess that&#39;s all we can do with a blocking FFI :(<br><br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<font color="#888888">
<br>
Levente</font><div><div></div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks<br>
<br>
Mariano<br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Levente<br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<a href="http://www.squeakdbx.org/documentation/Asynchronous%20queries" target="_blank">http://www.squeakdbx.org/documentation/Asynchronous%20queries</a><br>
<br>
Eliot implemented a multi-threaded FFI for Cog but so far I am not sure if<br>
it is already working.<br>
<br>
Cheers<br>
<br>
--<br>
Mariano<br>
<a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br>
<br>
 _______________________________________________<br>
</blockquote>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
<br>
</blockquote>
<br>
<br>
<br>
-- <br>
Mariano<br>
<a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br>
<br>
</blockquote>
_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br><br>