nginx, echo module & lua

agentzh agentzh at gmail.com
Thu May 3 12:34:12 UTC 2012


On Thu, May 3, 2012 at 7:34 AM, Pierre <serarien at baqs.net> wrote:
>> There's already several Lua drivers based on that, including
>> memcached, redis, mysql, http, and mongodb. For instance, the
>> lua-resty-redis library:
>>
>> https://github.com/agentzh/lua-resty-redis
>>
>
> how can I combine cosocket & foreign upstream ?
> also, I didn't find any example involving cosocket between locations, or maybe
> I'm getting it wrong.
>

The cosocket API is used to talk to remote servers in TCP or unix
domain sockets directly. It does not support the subrequest model at
all so it is not used for reusing existing upstream modules.

The "cosocket" term is short for "coroutine-based socket", it is a
parallel implementation as ngx_http_usptream, see the following graph:

    http://agentzh.org/misc/slides/libdrizzle-lua-nginx/#57

>> > 2. when in config: set_by_lua_file $varname luafile.lua , and luafile.lua
>> > references to ngx.ctx,
>> > I get the following error:
>> > (lua-error)...no request ctx found
>> > according to the doc, ngx.ctx is available in set_lua*, but does not work.
>> > Would anybody suggest
>> > me a workaround ?
>> >
>>
>> This is indeed a bug. Thanks for reporting this!
>>
>> I've just committed a patch for it:
>>
>> https://github.com/chaoslawful/lua-nginx-module/commit/bee1cab
>
> works like a charm, thanks !
>

Sorry, my previous patch introduced a bad memory leak and I've just
committed the following patch to fix this:

    https://github.com/chaoslawful/lua-nginx-module/commit/8d2878

Best regards,
-agentzh



More information about the nginx mailing list