Welcome! Log In Create A New Profile

Advanced

Re: nginx, echo module & lua

Pierre
May 03, 2012 06:44AM
Investigating a bit more, here is the conclusion:

location = /store {
internal;
#test 1
#echo_subrequest_async PUT /trucalacon -q 'filename=$arg_filename' -b $echo_request_body;
#test 2
#content_by_lua '
# local filename = ngx.req.get_uri_args()["md5"]
# local res = ngx.location.capture("/trucalacon",
# { args = {filename = filename } ,
# ctx = ngx.ctx })
#';
}
location = /trucalacon {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://otherserver;
}


using echo_subrequest_async, I directly reach :
2012/05/03 12:08:25 [error] 13204#0: *1 subrequests cycle while processing "/trucalacon",

using echo_subrequest, I get the same behaviour as ngx.location.capture

using content_by_lua + location.capture, everything is smooth.

/store is called by another lua script, which does
location.capture.multi('/store'), 20 by 20

Last interrogation:
What is the best way to discard body (I mean free the memory by body passed to subrequests ) ?



On 03/mai - 01:34, Pierre wrote:
> On 02/mai - 19:46, agentzh wrote:
> > Hello!
> >
> > On Wed, May 2, 2012 at 4:11 PM, Pierre <serarien@baqs.net> wrote:
> > > I'm trying to use both echo module & lua, but I'm having some issues:
> > >
> > > 1. I reach quickly "subrequests cycle". Looking @ the code, subrequests is
> > > unsigned:8,
> > > but I would need thousands of subrequests sometimes. putting subrequests to
> > > unsigned just
> > > results to crashes.
> > >
> >
> > There's no way to support thousands of subrequests in a single main
> > request without patching the nginx core.
> >
> > But you're encouraged to try out ngx_lua's cosocket API to avoid
> > subrequests altogether. And the cosocket stuff does not have such
> > limitations.
> >
> > 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.
>
> > > 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 !
>
> >
> > Could you try out the git master HEAD on your side?
> >
> > Thanks!
> > -agentzh
> >
> > _______________________________________________
> > nginx mailing list
> > nginx@nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx, echo module & lua

Pierre May 02, 2012 04:12AM

Re: nginx, echo module & lua

agentzh May 02, 2012 07:48AM

Re: nginx, echo module & lua

Pierre May 02, 2012 09:40AM

Re: nginx, echo module & lua

agentzh May 02, 2012 11:12AM

Re: nginx, echo module & lua

Pierre May 02, 2012 07:36PM

Re: nginx, echo module & lua

Antonio P.P. Almeida May 03, 2012 03:54AM

Re: nginx, echo module & lua

agentzh May 03, 2012 08:54AM

Re: nginx, echo module & lua

Pierre May 03, 2012 06:44AM

Re: nginx, echo module & lua

agentzh May 03, 2012 09:04AM

Re: nginx, echo module & lua

Pierre May 03, 2012 11:40AM

Re: nginx, echo module & lua

agentzh May 03, 2012 08:36AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 121
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready