lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Fri, Oct 23, 2009 at 5:53 PM, Stefan <> wrote:
> Fabio Mascarenhas wrote:
>> The generic wsapi.fcgi launcher does persist scripts (and each script
>> is isolated in its own Lua state), but each wsapi.fcgi process can
>> only serve a single request at a time, so you need to configure your
>> web server to keep multiple wsapi.fcgi workers to service concurrent
>> requests. wsapi.fcgi also reloads the script in a fresh Lua state if
>> the underlying file has been modified.
> So, does this mean that if you had say - 60 scripts - and were running 3
> launchers, you would end up with a total of 180 Lua states (and connections
> to the DB or other backend storage)?

Yep, the default setup trades memory consumption for application
isolation, as Lua states are pretty lightweight. But it is trivial to
have a wsapi.fcgi launcher without this isolation, you just have to
change it to use wsapi.common.load_wsapi instead of
wsapi.common.load_wsapi_isolated. But you also lose file reloading, so
you have to kill your wsapi.fcgi processes if you change a script.

Answering your other question, yes, wsapi.fcgi (with
load_wsapi_isolated) does a fstat for each request. I would love to
use some change notification service, but these are awfully
non-portable, and it is already hard enough to deal with subtle
incompatibilities among web servers.

Fabio Mascarenhas