<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>nginx, echo module &amp;amp; lua</title>
<description>Hi all,
I'm trying to use both echo module &amp;amp; lua, but I'm having some issues:
1. I reach quickly &amp;quot;subrequests cycle&amp;quot;. Looking @ the code, subrequests 
is unsigned:8,
but I would need thousands of subrequests sometimes. putting 
subrequests to unsigned just
results to crashes.
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 ?
I'm using luajit, openresty last version.
Thanks a lot in advance,
Pierre
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx</description><link>http://forum.nginx.org/read.php?2,225963,225963#msg-225963</link><lastBuildDate>Tue, 21 May 2013 10:10:38 -0400</lastBuildDate>
<generator>Phorum 5.2.16</generator>
<item>
<guid>http://forum.nginx.org/read.php?2,225963,226025#msg-226025</guid>
<title>Re: nginx, echo module &amp; lua</title><link>http://forum.nginx.org/read.php?2,225963,226025#msg-226025</link><description><![CDATA[On 03/mai - 21:03, agentzh wrote:<br />&gt; On Thu, May 3, 2012 at 6:43 PM, Pierre &lt;serarien@baqs.net&gt; wrote:<br />&gt; &gt;<br />&gt; &gt;<br />&gt; &gt; using echo_subrequest_async, I directly reach :<br />&gt; &gt; 2012/05/03 12:08:25 [error] 13204#0: *1 subrequests cycle while processing &quot;/trucalacon&quot;,<br />&gt; &gt;<br />&gt;<br />&gt; Which version of nginx are you using?<br />tested on openresty 10.0.10 abd 1.0.11<br />&gt;<br />&gt; &gt;<br />&gt; &gt; Last interrogation:<br />&gt; &gt; What is the best way to discard body (I mean free the memory by body passed to subrequests ) ?<br />&gt; &gt;<br />&gt;<br />&gt; There's no way to release all the memory of a subrequest instantly<br />&gt; because nginx subrequests share the same memory pool as their parent<br />&gt; request. So for long-running requests that issue a lot of serial<br />&gt; subrequests, there will be a good chance of temporary memory leaks in<br />&gt; the lifetime of the main request.<br />ok, thx<br />&gt;<br />&gt; It's worth mentioning that the ngx_lua cosocket API does not suffer<br />&gt; from this issue because Lua GC handles the resource lifetime there.<br />:)<br />&gt;<br />&gt; Best regards,<br />&gt; -agentzh<br />&gt;<br />&gt; _______________________________________________<br />&gt; nginx mailing list<br />&gt; nginx@nginx.org<br />&gt; http://mailman.nginx.org/mailman/listinfo/nginx<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>Pierre</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Thu, 03 May 2012 11:40:00 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,225963,226014#msg-226014</guid>
<title>Re: nginx, echo module &amp; lua</title><link>http://forum.nginx.org/read.php?2,225963,226014#msg-226014</link><description><![CDATA[On Thu, May 3, 2012 at 6:43 PM, Pierre &lt;serarien@baqs.net&gt; wrote:<br />&gt;<br />&gt;<br />&gt; using echo_subrequest_async, I directly reach :<br />&gt; 2012/05/03 12:08:25 [error] 13204#0: *1 subrequests cycle while processing &quot;/trucalacon&quot;,<br />&gt;<br /><br />Which version of nginx are you using?<br /><br />&gt;<br />&gt; Last interrogation:<br />&gt; What is the best way to discard body (I mean free the memory by body passed to subrequests ) ?<br />&gt;<br /><br />There's no way to release all the memory of a subrequest instantly<br />because nginx subrequests share the same memory pool as their parent<br />request. So for long-running requests that issue a lot of serial<br />subrequests, there will be a good chance of temporary memory leaks in<br />the lifetime of the main request.<br /><br />It's worth mentioning that the ngx_lua cosocket API does not suffer<br />from this issue because Lua GC handles the resource lifetime there.<br /><br />Best regards,<br />-agentzh<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>agentzh</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Thu, 03 May 2012 09:04:01 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,225963,226012#msg-226012</guid>
<title>Re: nginx, echo module &amp; lua</title><link>http://forum.nginx.org/read.php?2,225963,226012#msg-226012</link><description><![CDATA[On Thu, May 3, 2012 at 3:53 PM, Antonio P.P. Almeida &lt;appa@perusio.net&gt; wrote:<br />&gt; A little thread hijacking. Are there plans to provide an HTTP response<br />&gt; parser? I suppose that for performance reasons that would have to<br />&gt; be in C along the lines of the Redis parser.<br />&gt;<br />&gt; https://github.com/agentzh/lua-redis-parser<br />&gt;<br />&gt; That's what's missing, IMHO, in order to completely replace<br />&gt; luasocket.<br />&gt;<br /><br />Liseen Wan has been working on the lua-resty-http library:<br /><br />https://github.com/liseen/lua-resty-http<br /><br />We'll extend that to support more and more HTTP features in the near future.<br /><br />But I think it will remain pure Lua because introducing C may not<br />really help here given the performance of LuaJIT 2.0 (and it has<br />already been proven in lua-resty-mysql where rewriting the MySQL<br />packet parser in C actually slowed things down because going across<br />language boundary is more expensive).<br /><br />But anyway we can provide pure C API for ngx_lua cosocket, just like<br />ngx_http_upstream, so a pure C implementation for those lua-resty-*<br />library will have a chance to achieve better performance than the pure<br />Lua implementations, but I'm not 100% sure ;)<br /><br />Regards,<br />-agentzh<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>agentzh</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Thu, 03 May 2012 08:54:01 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,225963,226011#msg-226011</guid>
<title>Re: nginx, echo module &amp; lua</title><link>http://forum.nginx.org/read.php?2,225963,226011#msg-226011</link><description><![CDATA[On Thu, May 3, 2012 at 7:34 AM, Pierre &lt;serarien@baqs.net&gt; wrote:<br />&gt;&gt; There's already several Lua drivers based on that, including<br />&gt;&gt; memcached, redis, mysql, http, and mongodb. For instance, the<br />&gt;&gt; lua-resty-redis library:<br />&gt;&gt;<br />&gt;&gt; https://github.com/agentzh/lua-resty-redis<br />&gt;&gt;<br />&gt;<br />&gt; how can I combine cosocket &amp; foreign upstream ?<br />&gt; also, I didn't find any example involving cosocket between locations, or maybe<br />&gt; I'm getting it wrong.<br />&gt;<br /><br />The cosocket API is used to talk to remote servers in TCP or unix<br />domain sockets directly. It does not support the subrequest model at<br />all so it is not used for reusing existing upstream modules.<br /><br />The &quot;cosocket&quot; term is short for &quot;coroutine-based socket&quot;, it is a<br />parallel implementation as ngx_http_usptream, see the following graph:<br /><br />http://agentzh.org/misc/slides/libdrizzle-lua-nginx/#57<br /><br />&gt;&gt; &gt; 2. when in config: set_by_lua_file $varname luafile.lua , and luafile.lua<br />&gt;&gt; &gt; references to ngx.ctx,<br />&gt;&gt; &gt; I get the following error:<br />&gt;&gt; &gt; (lua-error)...no request ctx found<br />&gt;&gt; &gt; according to the doc, ngx.ctx is available in set_lua*, but does not work.<br />&gt;&gt; &gt; Would anybody suggest<br />&gt;&gt; &gt; me a workaround ?<br />&gt;&gt; &gt;<br />&gt;&gt;<br />&gt;&gt; This is indeed a bug. Thanks for reporting this!<br />&gt;&gt;<br />&gt;&gt; I've just committed a patch for it:<br />&gt;&gt;<br />&gt;&gt; https://github.com/chaoslawful/lua-nginx-module/commit/bee1cab<br />&gt;<br />&gt; works like a charm, thanks !<br />&gt;<br /><br />Sorry, my previous patch introduced a bad memory leak and I've just<br />committed the following patch to fix this:<br /><br />https://github.com/chaoslawful/lua-nginx-module/commit/8d2878<br /><br />Best regards,<br />-agentzh<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>agentzh</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Thu, 03 May 2012 08:36:01 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,225963,226009#msg-226009</guid>
<title>Re: nginx, echo module &amp; lua</title><link>http://forum.nginx.org/read.php?2,225963,226009#msg-226009</link><description><![CDATA[Investigating a bit more, here is the conclusion:<br /><br />location = /store {<br />internal;<br />#test 1<br />#echo_subrequest_async PUT /trucalacon -q 'filename=$arg_filename' -b $echo_request_body;<br />#test 2<br />#content_by_lua '<br /># local filename = ngx.req.get_uri_args()[&quot;md5&quot;]<br /># local res = ngx.location.capture(&quot;/trucalacon&quot;,<br /># { args = {filename = filename } ,<br /># ctx = ngx.ctx })<br />#';<br />}<br />location = /trucalacon {<br />proxy_set_header X-Real-IP $remote_addr;<br />proxy_pass http://otherserver;<br />}<br /><br /><br />using echo_subrequest_async, I directly reach :<br />2012/05/03 12:08:25 [error] 13204#0: *1 subrequests cycle while processing &quot;/trucalacon&quot;,<br /><br />using echo_subrequest, I get the same behaviour as ngx.location.capture<br /><br />using content_by_lua + location.capture, everything is smooth.<br /><br />/store is called by another lua script, which does<br />location.capture.multi('/store'), 20 by 20<br /><br />Last interrogation:<br />What is the best way to discard body (I mean free the memory by body passed to subrequests ) ?<br /><br /><br /><br />On 03/mai - 01:34, Pierre wrote:<br />&gt; On 02/mai - 19:46, agentzh wrote:<br />&gt; &gt; Hello!<br />&gt; &gt;<br />&gt; &gt; On Wed, May 2, 2012 at 4:11 PM, Pierre &lt;serarien@baqs.net&gt; wrote:<br />&gt; &gt; &gt; I'm trying to use both echo module &amp; lua, but I'm having some issues:<br />&gt; &gt; &gt;<br />&gt; &gt; &gt; 1. I reach quickly &quot;subrequests cycle&quot;. Looking @ the code, subrequests is<br />&gt; &gt; &gt; unsigned:8,<br />&gt; &gt; &gt; but I would need thousands of subrequests sometimes. putting subrequests to<br />&gt; &gt; &gt; unsigned just<br />&gt; &gt; &gt; results to crashes.<br />&gt; &gt; &gt;<br />&gt; &gt;<br />&gt; &gt; There's no way to support thousands of subrequests in a single main<br />&gt; &gt; request without patching the nginx core.<br />&gt; &gt;<br />&gt; &gt; But you're encouraged to try out ngx_lua's cosocket API to avoid<br />&gt; &gt; subrequests altogether. And the cosocket stuff does not have such<br />&gt; &gt; limitations.<br />&gt; &gt;<br />&gt; &gt; There's already several Lua drivers based on that, including<br />&gt; &gt; memcached, redis, mysql, http, and mongodb. For instance, the<br />&gt; &gt; lua-resty-redis library:<br />&gt; &gt;<br />&gt; &gt; https://github.com/agentzh/lua-resty-redis<br />&gt; &gt;<br />&gt;<br />&gt; how can I combine cosocket &amp; foreign upstream ?<br />&gt; also, I didn't find any example involving cosocket between locations, or maybe<br />&gt; I'm getting it wrong.<br />&gt;<br />&gt; &gt; &gt; 2. when in config: set_by_lua_file $varname luafile.lua , and luafile.lua<br />&gt; &gt; &gt; references to ngx.ctx,<br />&gt; &gt; &gt; I get the following error:<br />&gt; &gt; &gt; (lua-error)...no request ctx found<br />&gt; &gt; &gt; according to the doc, ngx.ctx is available in set_lua*, but does not work.<br />&gt; &gt; &gt; Would anybody suggest<br />&gt; &gt; &gt; me a workaround ?<br />&gt; &gt; &gt;<br />&gt; &gt;<br />&gt; &gt; This is indeed a bug. Thanks for reporting this!<br />&gt; &gt;<br />&gt; &gt; I've just committed a patch for it:<br />&gt; &gt;<br />&gt; &gt; https://github.com/chaoslawful/lua-nginx-module/commit/bee1cab<br />&gt;<br />&gt; works like a charm, thanks !<br />&gt;<br />&gt; &gt;<br />&gt; &gt; Could you try out the git master HEAD on your side?<br />&gt; &gt;<br />&gt; &gt; Thanks!<br />&gt; &gt; -agentzh<br />&gt; &gt;<br />&gt; &gt; _______________________________________________<br />&gt; &gt; nginx mailing list<br />&gt; &gt; nginx@nginx.org<br />&gt; &gt; http://mailman.nginx.org/mailman/listinfo/nginx<br />&gt;<br />&gt; _______________________________________________<br />&gt; nginx mailing list<br />&gt; nginx@nginx.org<br />&gt; http://mailman.nginx.org/mailman/listinfo/nginx<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>Pierre</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Thu, 03 May 2012 06:44:00 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,225963,226006#msg-226006</guid>
<title>Re: nginx, echo module &amp; lua</title><link>http://forum.nginx.org/read.php?2,225963,226006#msg-226006</link><description><![CDATA[A little thread hijacking. Are there plans to provide an HTTP response<br />parser? I suppose that for performance reasons that would have to<br />be in C along the lines of the Redis parser.<br /><br />https://github.com/agentzh/lua-redis-parser<br /><br />That's what's missing, IMHO, in order to completely replace<br />luasocket.<br /><br />Great work as usual.<br /><br />--appa<br /><br />&gt; On 02/mai - 19:46, agentzh wrote:<br />&gt;&gt; Hello!<br />&gt;&gt;<br />&gt;&gt; On Wed, May 2, 2012 at 4:11 PM, Pierre &lt;serarien@baqs.net&gt; wrote:<br />&gt;&gt; &gt; I'm trying to use both echo module &amp; lua, but I'm having some issues:<br />&gt;&gt; &gt;<br />&gt;&gt; &gt; 1. I reach quickly &quot;subrequests cycle&quot;. Looking @ the code,<br />&gt;&gt; subrequests is<br />&gt;&gt; &gt; unsigned:8,<br />&gt;&gt; &gt; but I would need thousands of subrequests sometimes. putting<br />&gt;&gt; subrequests to<br />&gt;&gt; &gt; unsigned just<br />&gt;&gt; &gt; results to crashes.<br />&gt;&gt; &gt;<br />&gt;&gt;<br />&gt;&gt; There's no way to support thousands of subrequests in a single main<br />&gt;&gt; request without patching the nginx core.<br />&gt;&gt;<br />&gt;&gt; But you're encouraged to try out ngx_lua's cosocket API to avoid<br />&gt;&gt; subrequests altogether. And the cosocket stuff does not have such<br />&gt;&gt; limitations.<br />&gt;&gt;<br />&gt;&gt; There's already several Lua drivers based on that, including<br />&gt;&gt; memcached, redis, mysql, http, and mongodb. For instance, the<br />&gt;&gt; lua-resty-redis library:<br />&gt;&gt;<br />&gt;&gt; https://github.com/agentzh/lua-resty-redis<br />&gt;&gt;<br />&gt;<br />&gt; how can I combine cosocket &amp; foreign upstream ?<br />&gt; also, I didn't find any example involving cosocket between locations, or<br />&gt; maybe<br />&gt; I'm getting it wrong.<br />&gt;<br />&gt;&gt; &gt; 2. when in config: set_by_lua_file $varname luafile.lua , and<br />&gt;&gt; luafile.lua<br />&gt;&gt; &gt; references to ngx.ctx,<br />&gt;&gt; &gt; I get the following error:<br />&gt;&gt; &gt; (lua-error)...no request ctx found<br />&gt;&gt; &gt; according to the doc, ngx.ctx is available in set_lua*, but does not<br />&gt;&gt; work.<br />&gt;&gt; &gt; Would anybody suggest<br />&gt;&gt; &gt; me a workaround ?<br />&gt;&gt; &gt;<br />&gt;&gt;<br />&gt;&gt; This is indeed a bug. Thanks for reporting this!<br />&gt;&gt;<br />&gt;&gt; I've just committed a patch for it:<br />&gt;&gt;<br />&gt;&gt; https://github.com/chaoslawful/lua-nginx-module/commit/bee1cab<br />&gt;<br />&gt; works like a charm, thanks !<br />&gt;<br />&gt;&gt;<br />&gt;&gt; Could you try out the git master HEAD on your side?<br />&gt;&gt;<br />&gt;&gt; Thanks!<br />&gt;&gt; -agentzh<br />&gt;&gt;<br />&gt;&gt; _______________________________________________<br />&gt;&gt; nginx mailing list<br />&gt;&gt; nginx@nginx.org<br />&gt;&gt; http://mailman.nginx.org/mailman/listinfo/nginx<br />&gt;<br />&gt; _______________________________________________<br />&gt; nginx mailing list<br />&gt; nginx@nginx.org<br />&gt; http://mailman.nginx.org/mailman/listinfo/nginx<br />&gt;<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>Antonio P.P. Almeida</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Thu, 03 May 2012 03:54:01 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,225963,226001#msg-226001</guid>
<title>Re: nginx, echo module &amp; lua</title><link>http://forum.nginx.org/read.php?2,225963,226001#msg-226001</link><description><![CDATA[On 02/mai - 19:46, agentzh wrote:<br />&gt; Hello!<br />&gt;<br />&gt; On Wed, May 2, 2012 at 4:11 PM, Pierre &lt;serarien@baqs.net&gt; wrote:<br />&gt; &gt; I'm trying to use both echo module &amp; lua, but I'm having some issues:<br />&gt; &gt;<br />&gt; &gt; 1. I reach quickly &quot;subrequests cycle&quot;. Looking @ the code, subrequests is<br />&gt; &gt; unsigned:8,<br />&gt; &gt; but I would need thousands of subrequests sometimes. putting subrequests to<br />&gt; &gt; unsigned just<br />&gt; &gt; results to crashes.<br />&gt; &gt;<br />&gt;<br />&gt; There's no way to support thousands of subrequests in a single main<br />&gt; request without patching the nginx core.<br />&gt;<br />&gt; But you're encouraged to try out ngx_lua's cosocket API to avoid<br />&gt; subrequests altogether. And the cosocket stuff does not have such<br />&gt; limitations.<br />&gt;<br />&gt; There's already several Lua drivers based on that, including<br />&gt; memcached, redis, mysql, http, and mongodb. For instance, the<br />&gt; lua-resty-redis library:<br />&gt;<br />&gt; https://github.com/agentzh/lua-resty-redis<br />&gt;<br /><br />how can I combine cosocket &amp; foreign upstream ?<br />also, I didn't find any example involving cosocket between locations, or maybe<br />I'm getting it wrong.<br /><br />&gt; &gt; 2. when in config: set_by_lua_file $varname luafile.lua , and luafile.lua<br />&gt; &gt; references to ngx.ctx,<br />&gt; &gt; I get the following error:<br />&gt; &gt; (lua-error)...no request ctx found<br />&gt; &gt; according to the doc, ngx.ctx is available in set_lua*, but does not work.<br />&gt; &gt; Would anybody suggest<br />&gt; &gt; me a workaround ?<br />&gt; &gt;<br />&gt;<br />&gt; This is indeed a bug. Thanks for reporting this!<br />&gt;<br />&gt; I've just committed a patch for it:<br />&gt;<br />&gt; https://github.com/chaoslawful/lua-nginx-module/commit/bee1cab<br /><br />works like a charm, thanks !<br /><br />&gt;<br />&gt; Could you try out the git master HEAD on your side?<br />&gt;<br />&gt; Thanks!<br />&gt; -agentzh<br />&gt;<br />&gt; _______________________________________________<br />&gt; nginx mailing list<br />&gt; nginx@nginx.org<br />&gt; http://mailman.nginx.org/mailman/listinfo/nginx<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>Pierre</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Wed, 02 May 2012 19:36:00 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,225963,225981#msg-225981</guid>
<title>Re: nginx, echo module &amp; lua</title><link>http://forum.nginx.org/read.php?2,225963,225981#msg-225981</link><description><![CDATA[On Wed, May 2, 2012 at 9:39 PM, Pierre &lt;serarien@baqs.net&gt; wrote:<br />&gt;&gt; But you're encouraged to try out ngx_lua's cosocket API to avoid<br />&gt;&gt; subrequests altogether. And the cosocket stuff does not have such<br />&gt;&gt; limitations.<br />&gt; hmm, any more documentation about that ?<br /><br />See the official documentation for ngx_lua cosocket:<br /><br />http://wiki.nginx.org/HttpLuaModule#ngx.socket.tcp<br /><br />&gt; More about: how to implement it in my lua scripts ?<br />&gt;<br />&gt; is that it ? :<br />&gt;<br />&gt; local tcp = ngx.socket.tcp<br />&gt;<br />&gt; function new(self)<br />&gt;    return setmetatable({ sock = tcp() }, mt)<br />&gt; end<br />&gt; ?<br /><br />See the lua-resty-redis, lua-resty-memcached, and lua-resty-mysql<br />libraries as examples:<br /><br />https://github.com/agentzh/lua-resty-redis<br />https://github.com/agentzh/lua-resty-memcached<br />https://github.com/agentzh/lua-resty-mysql<br /><br />bigplum has been working on lua-resty-mongol:<br /><br />https://github.com/bigplum/lua-resty-mongol<br /><br />I'm not sure about its state, but you can read the document or contact<br />the author directly.<br /><br />Best regards,<br />-agentzh<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>agentzh</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Wed, 02 May 2012 11:12:00 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,225963,225978#msg-225978</guid>
<title>Re: nginx, echo module &amp; lua</title><link>http://forum.nginx.org/read.php?2,225963,225978#msg-225978</link><description><![CDATA[On 02/mai - 19:46, agentzh wrote:<br />&gt; Hello!<br />&gt;<br />&gt; On Wed, May 2, 2012 at 4:11 PM, Pierre &lt;serarien@baqs.net&gt; wrote:<br />&gt; &gt; I'm trying to use both echo module &amp; lua, but I'm having some issues:<br />&gt; &gt;<br />&gt; &gt; 1. I reach quickly &quot;subrequests cycle&quot;. Looking @ the code, subrequests is<br />&gt; &gt; unsigned:8,<br />&gt; &gt; but I would need thousands of subrequests sometimes. putting subrequests to<br />&gt; &gt; unsigned just<br />&gt; &gt; results to crashes.<br />&gt; &gt;<br />&gt;<br />&gt; There's no way to support thousands of subrequests in a single main<br />&gt; request without patching the nginx core.<br />ok<br />&gt;<br />&gt; But you're encouraged to try out ngx_lua's cosocket API to avoid<br />&gt; subrequests altogether. And the cosocket stuff does not have such<br />&gt; limitations.<br />hmm, any more documentation about that ?<br />More about: how to implement it in my lua scripts ?<br /><br />is that it ? :<br /><br />local tcp = ngx.socket.tcp<br /><br />function new(self)<br />return setmetatable({ sock = tcp() }, mt)<br />end<br /><br />?<br /><br /><br />&gt;<br />&gt; There's already several Lua drivers based on that, including<br />&gt; memcached, redis, mysql, http, and mongodb. For instance, the<br />&gt; lua-resty-redis library:<br />mongodb: you mean mongofs or mongodb ?<br />&gt;<br />&gt; https://github.com/agentzh/lua-resty-redis<br />&gt;<br />&gt; &gt; 2. when in config: set_by_lua_file $varname luafile.lua , and luafile.lua<br />&gt; &gt; references to ngx.ctx,<br />&gt; &gt; I get the following error:<br />&gt; &gt; (lua-error)...no request ctx found<br />&gt; &gt; according to the doc, ngx.ctx is available in set_lua*, but does not work.<br />&gt; &gt; Would anybody suggest<br />&gt; &gt; me a workaround ?<br />&gt; &gt;<br />&gt;<br />&gt; This is indeed a bug. Thanks for reporting this!<br />&gt;<br />&gt; I've just committed a patch for it:<br />&gt;<br />&gt; https://github.com/chaoslawful/lua-nginx-module/commit/bee1cab<br />woh, thx !<br />&gt;<br />&gt; Could you try out the git master HEAD on your side?<br />I will<br />&gt;<br />&gt; Thanks!<br />&gt; -agentzh<br />&gt;<br />&gt; _______________________________________________<br />&gt; nginx mailing list<br />&gt; nginx@nginx.org<br />&gt; http://mailman.nginx.org/mailman/listinfo/nginx<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>Pierre</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Wed, 02 May 2012 09:40:00 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,225963,225974#msg-225974</guid>
<title>Re: nginx, echo module &amp; lua</title><link>http://forum.nginx.org/read.php?2,225963,225974#msg-225974</link><description><![CDATA[Hello!<br /><br />On Wed, May 2, 2012 at 4:11 PM, Pierre &lt;serarien@baqs.net&gt; wrote:<br />&gt; I'm trying to use both echo module &amp; lua, but I'm having some issues:<br />&gt;<br />&gt; 1. I reach quickly &quot;subrequests cycle&quot;. Looking @ the code, subrequests is<br />&gt; unsigned:8,<br />&gt; but I would need thousands of subrequests sometimes. putting subrequests to<br />&gt; unsigned just<br />&gt; results to crashes.<br />&gt;<br /><br />There's no way to support thousands of subrequests in a single main<br />request without patching the nginx core.<br /><br />But you're encouraged to try out ngx_lua's cosocket API to avoid<br />subrequests altogether. And the cosocket stuff does not have such<br />limitations.<br /><br />There's already several Lua drivers based on that, including<br />memcached, redis, mysql, http, and mongodb. For instance, the<br />lua-resty-redis library:<br /><br />https://github.com/agentzh/lua-resty-redis<br /><br />&gt; 2. when in config: set_by_lua_file $varname luafile.lua , and luafile.lua<br />&gt; references to ngx.ctx,<br />&gt; I get the following error:<br />&gt; (lua-error)...no request ctx found<br />&gt; according to the doc, ngx.ctx is available in set_lua*, but does not work.<br />&gt; Would anybody suggest<br />&gt; me a workaround ?<br />&gt;<br /><br />This is indeed a bug. Thanks for reporting this!<br /><br />I've just committed a patch for it:<br /><br />https://github.com/chaoslawful/lua-nginx-module/commit/bee1cab<br /><br />Could you try out the git master HEAD on your side?<br /><br />Thanks!<br />-agentzh<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>agentzh</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Wed, 02 May 2012 07:48:00 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,225963,225963#msg-225963</guid>
<title>nginx, echo module &amp; lua</title><link>http://forum.nginx.org/read.php?2,225963,225963#msg-225963</link><description><![CDATA[Hi all,<br /><br />I'm trying to use both echo module &amp; lua, but I'm having some issues:<br /><br />1. I reach quickly &quot;subrequests cycle&quot;. Looking @ the code, subrequests<br />is unsigned:8,<br />but I would need thousands of subrequests sometimes. putting<br />subrequests to unsigned just<br />results to crashes.<br /><br />2. when in config: set_by_lua_file $varname luafile.lua , and<br />luafile.lua references to ngx.ctx,<br />I get the following error:<br />(lua-error)...no request ctx found<br />according to the doc, ngx.ctx is available in set_lua*, but does not<br />work. Would anybody suggest<br />me a workaround ?<br /><br />I'm using luajit, openresty last version.<br /><br /><br />Thanks a lot in advance,<br />Pierre<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>Pierre</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Wed, 02 May 2012 04:12:00 -0400</pubDate></item>
</channel>
</rss>