lua-users home
lua-l archive

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


On Sun, Mar 1, 2015 at 12:13 AM, Joh Journeyer J.
<oosaprogrammer@gmail.com> wrote:
> Hi list,
>
> I am studying about wsapi and orbit.
> wsapi homepage says that wsapi support cgi, fast-cgi and xavante.
>
> I wonder how xavante works/interface with web app.
> Does it use cgi or fast-cgi? It seems not.. Then Does xavante interface with

It uses neither. Xavante has its own API to talk to Lua web
applications, and the wsapi-xavante provides a bridge between that and
the WSAPI interface.

> webapp without 3rd party program call? I mean, are web apps - in the xavante
> case - integrated into xavante as a one process? I mean is xavante web app
> just a module of xavante? So xavante doesn't need cgi or fast-cgi? Is this
> similar to php?

You have two options when running WSAPI applications on Xavante: you
can either run them in the same Lua state, sharing the global
environment, modules, etc. with Xavante and other apps you are running
that way, or you can run the app in its own state (using Rings), where
it will have its own global namespace and modules (Rings does not
provide perfect isolation, though, as global C variables still leak
between different states).

> And how xavante process simultaneous request? Does it support multi-thread?
> or just it only uses coroutine - multi thread like ... but not the real
> multi thread ?

Xavante is a single-threaded web server that uses a coroutine for each
request, when a request is blocked waiting for the network Xavante
will service others, so you still have to be careful with other
sources of blocking, such as the database. Xavante was designed for
embedded use, or as a lightweight webserver for development, it is not
a replacement for using a heavy-duty webserver such as Apache or
nginx.

> Thank you very much in advance!
>
> Journeyer

--
Fabio Mascarenhas