[ANN] ngx_lua v0.1.5: ability to capture multiple parallel subrequests
Roman Vasilyev
roman at anchorfree.com
Fri Feb 11 01:41:43 MSK 2011
On 02/10/2011 02:38 PM, Roman Vasilyev wrote:
> I've updated on one of my production servers mod-lua to 0.1.5, and
> nginx memory still growing.
> My config is still the same
> location / {
> include forward_proxy.conf;
>
> location = /check-spam {
> internal;
>
> include spam_fastcgi.conf;
> }
>
> lua_need_request_body on;
>
> rewrite_by_lua '
> if ngx.var.request_method ~= "POST" then
> return
> end
> local res = ngx.location.capture( "/check-spam",
> { method = ngx.HTTP_POST, body = ngx.var.request_body })
> local a=string.sub(res.body,0,4)=="SPAM"
> if a then
> return ngx.redirect("/terms-of-use.html")
> end';
> }
>
Forgot to say that below is my error log with 2 very frequent messages:
>
> 2011/02/10 12:36:00 [alert] 3090#0: *21747555 zero size buf in output
> t:1 r:0 f:0 0000000006D42970 0000000006D42970-0000000006D42970
> 0000000000000000 0-0 while sending request to upstream, client:
> 10.1.24.20, server: hss, request: "POST /xxx/xxx.asmx HTTP/1.1",
> upstream: "http://x.x.x.x/xxx/xxx.asmx", host: "xxx.com"
> 2011/02/10 12:36:07 [alert] 3085#0: *21749071 sendfile() failed (9:
> Bad file descriptor) while sending request to upstream, client:
> 10.1.16.17, server: hss, request: "POST /xxx/xxx.aspx HTTP/1.1",
> upstream: "http://x.x.x.x/xxx/xxx.aspx", host: "xxx.com"
>
> On 02/10/2011 02:36 AM, agentzh wrote:
>> On Thu, Feb 10, 2011 at 6:26 PM, Alexander Kunz<akunz at ntmedia.de>
>> wrote:
>>> Thanks for sharing so many of your Nginx addons, Nginx scripting is so
>>> exciting. I read
>>> your 2 slides about Nginx scripting. Very intersting, are there some
>>> more
>>> examples or informations
>>> about Nginx scripting?
>>>
>> Maybe my blog count? ;)
>>
>> http://agentzh.blogspot.com/
>>
>> I do have the plan of writing a bunch of (detailed) tutorials on this
>> this year.
>>
>>> I try out your example, you subrequest on a redis location. I use
>>> the redis2
>>> addon, but i
>>> allways get in the first line the bytes for my redis request. Is
>>> there a
>>> solution hide this information?
>> The ngx_redis2 module returns the raw TCP response from the redis
>> server. It's recommended to use my lua-redis-parser module (written in
>> pure C) to parse these responses into lua data structure:
>>
>> https://github.com/agentzh/lua-redis-parser
>>
>> If you only want to use the "get" redis command, you can try out the
>> ngx_redis module here:
>>
>> http://wiki.nginx.org/HttpRedis
>>
>> It returns the parsed content part of the redis response because only
>> "get" is needed to implement.
>>
>>> So it would be possible to use redis2 for caching whole HTML pages.
>>>
>> Right, using ngx_srcache + ngx_lua + lua-redis-parser. See ngx_srcache
>> for details:
>>
>> http://github.com/agentzh/srcache-nginx-module
>>
>> It's much like Apache2's mod_cache, but only support silly response
>> body caching (for now) and is 100% non-blocking. I're already using
>> ngx_srcache + ngx_memc to cache responses via memcached in production.
>>
>>> Have a nice day agentzh!
>>>
>> Thanks! :) The same to you ;)
>>
>> Cheers,
>> -agentzh
>>
>> _______________________________________________
>> nginx mailing list
>> nginx at nginx.org
>> http://nginx.org/mailman/listinfo/nginx
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
More information about the nginx
mailing list