[ANN] ngx_lua v0.1.5: ability to capture multiple parallelsubrequests

agentzh agentzh at gmail.com
Fri Feb 11 06:55:09 MSK 2011


On Fri, Feb 11, 2011 at 2:12 AM, Akins, Brian <Brian.Akins at turner.com> wrote:
>  agentzh,
>
> I was wondering if you had considered having a capture mode that used a
> callback rather than coroutines?  In really high traffic servers, the
> coroutines seem to eat a good bit of memory.
>

Have you tried LuaJIT 2.0? It saves 25+% of the total RAM used by our
nginx worker processes in our business, compared to the standard Lua
5.1 interpreter. Also the latter's coroutine implementation is
suboptimal.

Another issue is that most of the upstream modules do not release its
output bufs as early as possible in the context of subrequests, they
usually rely on the nginx memory pool to release all those bufs when
the pool is destroyed at the end of the main request, which is quite
unacceptable. We'll fix our upstream modules and possibly other
standard modules (via patches) to release buffers at the end of the
subrequest, rather than main request.

Technically speaking, callbacks won't save memory, we still need to
save all your Lua context such that you can get access to data in the
outer context in your Lua callback, or it'll be useless :)

Cheers,
-agentzh



More information about the nginx mailing list