On Sun, May 20, 2012 at 5:19 PM, Tzury Bar Yochay <tz...@reblaze.com> wrote:
> I wonder if there is a safe way to make several lua functions process in
> parallel without breaking anything at the nginx IOLoop.
This will be eventually achieved by the ngx.thread API, as
demonstrated by the following code samples that cannot run for now:
The "thread" here will be implemented by Lua coroutines. And every
nginx request processing cycle will correspond to more than more Lua
coroutines since then.
At the moment, the only way of achieving concurrent processing in a
single request is to use the parallel nginx subrequests, for example,
the ngx.location.capture_multi API:
> I have managed to find some lua tools that let one work in a "multi
> threaded" fashion (one of my favorites is LuaTask
> https://github.com/LuaDist/luatask), yet, I wanted to consult this mailing
> list on the subject.
Such Lua modules have no knowledge of the nginx event model and will
almost always break things in the context of ngx_lua.