<div dir="ltr">On Mon, Jul 29, 2013 at 10:55 PM, Anand Avati <span dir="ltr">&lt;<a href="mailto:anand.avati@gmail.com" target="_blank">anand.avati@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote">
<div class="im">On Mon, Jul 29, 2013 at 8:36 AM, Roberto De Ioris <span dir="ltr">&lt;<a href="mailto:roberto@unbit.it" target="_blank">roberto@unbit.it</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
Hi everyone, i have just committed a plugin for the uWSGI application server<br>
for exposing glusterfs filesystems using the new native api:<br>
<br>
<a href="https://github.com/unbit/uwsgi-docs/blob/master/GlusterFS.rst" target="_blank">https://github.com/unbit/uwsgi-docs/blob/master/GlusterFS.rst</a><br>
<br>
Currently it is very simple, but works really well.<br>
<br>
I have studied the whole api, and i have two questions:<br>
<br>
why there is no glfs_stat_async() ?<br>
<br>
if i understand the code well, even stat() is a blocking operation.<br></blockquote><div><br></div></div><div>Can you show some code in uwsgi which makes use of asynchronous stat calls? Adding an async stat call in gfapi is not hard, but the use case hasn&#39;t been clear.</div>
<div class="im">
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
My objective is avoiding the use of threads and processes and use the<br>
uWSGI async api to implement a non blocking-approach (mixable with other<br>
engines like gevent or Coro::AnyEvent)<br></blockquote><div><br></div></div><div>Are there any requirements that the callback happen only in specific threads? That is typically a common requirement, and the async callbacks would end up requiring special &quot;wiring&quot; to bring the callbacks to desired threads. But I guess that wiring would already be done with the IO callbacks anyways in your case.</div>

<div><br></div><div>Do you have some prototype of the module using gfapi out somewhere? I&#39;m hoping to understand the use case of gfapi and see if something can be done to make it integrate with Coro::AnyEvent more &quot;naturally&quot;.</div>
</div></div></div></blockquote><div><br></div><div><br></div><div>I am assuming the module in question is this - <a href="https://github.com/unbit/uwsgi/blob/master/plugins/glusterfs/glusterfs.c">https://github.com/unbit/uwsgi/blob/master/plugins/glusterfs/glusterfs.c</a>. I see that you are not using the async variants of any of the glfs calls so far. I also believe you would like these &quot;synchronous&quot; calls to play nicely with Coro:: by yielding in a compatible way (and getting woken up when response arrives in a compatible way) - rather than implementing an explicit glfs_stat_async(). The -&gt;request() method does not seem to be be naturally allowing the use of &quot;explictly asynchronous&quot; calls within.</div>
<div><br></div><div>Can you provide some details of the event/request management in use? If possible, I would like to provide hooks for yield and wakeup primitives in gfapi (which you can wire with Coro:: or anything else) such that these seemingly synchronous calls (glfs_open, glfs_stat etc.) don&#39;t starve the app thread without yielding.</div>
<div><br></div><div>I can see those hooks having a benefit in the qemu gfapi driver too, removing a bit of code there which integrates callbacks into the event loop using pipes.</div><div><br></div><div>Avati</div><div><br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">
<div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Another thing is the bison/yacc nameclash. uWSGI allows you to load<br>
various external libraries and the use of the default &#39;yy&#39; prefix causes<br>
nameclashes with common libraries (like matheval).<br>
<br>
I understand that matheval too should choose a better approach, but why<br>
not prefixing it like glusterfsyy ? This would avoid headaches, even for<br>
when people will start using the library in higher level languages.<br>
<br>
Currently i have tried the YFLAGS env var hack for ./configure but it did<br>
not work (i am using bison)<br>
<br>
YFLAGS=&quot;-Dapi.prefix=glusterfsyy -d&quot; ./configure --prefix=/opt/glusterfs/<br></blockquote><div><br></div></div><div>Hmm, this is nice to get fixed. Do you already have a patch which you have used (other than just the &quot;technique&quot; shown above)?</div>

<div><br></div><div><br></div><div>Thanks!</div><span class=""><font color="#888888"><div>Avati</div><div><br></div></font></span></div></div></div>
</blockquote></div><br></div></div>