<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 12, 2014 at 1:45 PM, erankor2 <span dir="ltr"><<a href="mailto:nginx-forum@nginx.us" target="_blank">nginx-forum@nginx.us</a>></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">Hi All,<br>
<br>
I want to develop an Nginx HTTP module that gets several values from<br>
memcache, performs some processing on them and returns the result to the<br>
client. I want all memcache operations to be performed asynchronously<br>
without blocking the worker process for maximum scalability. For this<br>
reason, I can't use libmemcached, and I'm looking for something that is<br>
built on Nginx.<br>
Is anyone familiar with a piece of code that does that ?<br>
<br>
Some more details:<br>
As I understand, it is theoretically possible to use the existing memcache<br>
upstream module for this, using subrequests. For example, to get a value I<br>
could start a subrequest for it and then handle the result when the<br>
subrequest completes. But this approach sounds a bit awkward, and it has the<br>
unnecessary overhead of processing all these dummy HTTP requests.<br>
What I would like ideally, is a module that exposes a function like -<br>
memcache_get(keyname, callback, context), where the callback is called<br>
either with the value if successful or an error code. I started writing such<br>
a module using the http_upstream module as reference, but found that it<br>
takes quite a bit of code to get it done, with lots of edge cases to handle<br>
(like timeouts in each one of the states)<br>
<br></blockquote><div><br></div><div>yeah, use the <a href="http://openresty.org/">http://openresty.org/</a> framework which includes: <a href="https://github.com/agentzh/lua-resty-memcached">https://github.com/agentzh/lua-resty-memcached</a></div>
<div><br></div><div>it couldn't be more perfect fit for what you're asking.</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">
Thank you !<br>
<br>
Eran<br>
<br>
Posted at Nginx Forum: <a href="http://forum.nginx.org/read.php?2,247481,247481#msg-247481" target="_blank">http://forum.nginx.org/read.php?2,247481,247481#msg-247481</a><br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div><br></div></div>