Help on designing using multiple location/upstream modules
Yichun Zhang (agentzh)
agentzh at gmail.com
Wed Nov 27 20:39:15 UTC 2013
Hello!
On Tue, Nov 26, 2013 at 4:30 AM, Reetesh Ranjan wrote:
> I have thought of the following design, in terms of nginx modules I would
> use:
>
> 1 My main location module that picks the keywords entered and communicates
> to Redis and Sphinx
> 2 For communicating to Redis I thought of using HttpRedis2Module
> (http://wiki.nginx.org/HttpRedis2Module)
> 3 For communicating with Sphinx, I am trying to write a simple C++ client
> or adapt the Sphinx C++ client
> (http://sourceforge.net/projects/cppsphinxclient/) or its parts into an
> upstream module.
>
This looks trivial if you use ngx_lua module as the glue. In
particular you can check out the ngx.location.capture and
ngx.location.capture_multi API functions for captured subrequests:
https://github.com/chaoslawful/lua-nginx-module#ngxlocationcapture
https://github.com/chaoslawful/lua-nginx-module#ngxlocationcapture_multi
And probably also the "light thread" API that can work with the
subrequest API above:
https://github.com/chaoslawful/lua-nginx-module#ngxthreadspawn
When using the Lua API provided by ngx_lua, everything is nonblocking
out of the box :)
Regards,
-agentzh
More information about the nginx-devel
mailing list