Hello!
On Sat, Oct 27, 2012 at 9:28 PM, Maanas Royy wrote:
> Thanks all
> So I can assume this is ok till I hit some problems
>
> [[%[%{"no":(%d+),"uid":(%d+),"status":(%d+)%}%]%s*]])
>
> I am trying to avoid external lua files as it will require loading of lua
> file on each call
No, by default external .lua files are also loaded only once and
cached in the global Lua VM state, unless you explicitly turn off the
lua_code_cache directive:
http://wiki.nginx.org/HttpLuaModule#lua_code_cache
The underlying code path for content_by_lua_file is essentially the
same as content_by_lua. You can do some benchmark yourself :)
Real-world Lua applications running atop ngx_lua almost always use
external .lua files because the code size can be really big.
For example, in the year 2011, the lz.taobao.com site already ran more
than 1 mega bytes of Lua source to serve tens of millions of requests
on 2 or 3 moderate machines everyday.
Best regards,
-agentzh