[ANN] ngx_lua v0.1.5: ability to capture multiple parallel subrequests
Alexander Kunz
akunz at ntmedia.de
Thu Feb 10 13:26:12 MSK 2011
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?
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?
So it would be possible to use redis2 for caching whole HTML pages.
Have a nice day agentzh!
Best regards
Alexander
On 10.02.2011 06:30, agentzh wrote:
> On Wed, Feb 9, 2011 at 6:34 PM, Marcus Clyne<maccaday at gmail.com> wrote:
>> Hi,
>>
>> Nice work guys!
>>
> Thanks! :D
>
>> Is it also possible to pass an array of requests and get an array of
>> responses, or otherwise send requests in parallel when you don't know in
>> advance how many subrequests you want to issue?
>>
> Sure! For instance,
>
> -- construct the requests table
> local reqs = {}
> table.insert(reqs, { "/mysql" })
> table.insert(reqs, { "/postgres" })
> table.insert(reqs, { "/redis" })
> table.insert(reqs, { "/memcached" })
>
> -- issue all the requests at once and wait when they all return
> local resps = { ngx.location.capture_multi(reqs) }
>
> -- loop over the responses table
> for i, resp in ipairs(resps) do
> -- process the response table "resp"
> end
>
> Well, it's mostly a feature on the Lua language level ;)
>
>> Looking at the documentation, it doesn't appear that this is currently
>> possible.
> I'll add a note for this to ngx_lua's documentation :)
>
>> I'd like to get into using Lua on Nginx for something I'm working on right
>> now that issues lots of subrequests, but I don't know how many I need to
>> issue in advance.
>>
> Yeah, that's understandable :)
>
> BTW, I've cc'd the nginx mailing list for reference :)
>
> Cheers,
> -agentzh
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
More information about the nginx
mailing list