lua-users home
lua-l archive

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


On 23 Oct 2009, at 10:58 AM, Stefan wrote:

Hello all, I was recently looking at different ways to switch our web application written in Lua from apache to nginx (we are currently using mod_wombat *in production* to earn a living).

One night, I started with the FastCGI devkit threaded.c example, and after a bit'o'hackin started to see some promising results. It is multi-threaded and very lightweight, with Lua VM states that persist between HTTP requests.

So I tossed it up on http://github.com/STPeters/luafcgid and now I have come to the point where I will be building the interface (API?) from Lua land back to the worker thread. I was going to just build a mod_wombat compatible one, but then thought I would ask here - just in case anyone else was interested in one day using this abomination.

WSAPI comes to mind as a potential target...

[cc'd to Kepler list]

FastCGI is definitely the way to go, but if you haven't, do check out wsapi-fcgi which is part of Kepler (http://keplerproject.org/). I use this with spawn-fcgi and lighttpd/nginx. An additional FCGI-Lua interface may be unnecessary unless you want it to do something notably different to that of the Kepler WSAPI one.

I had actually been considering replacing wsapi-fcgi with something like your setup if only for simplicity...however now that I've measured yours against it, the extra functionality of wsapi-fcgi is probably worth its little additional overhead.

For a basic "hello world" test wsapi-fcgi yields results similar to yours (both in the region of 4,000+ requests per second on 2 cores) and the best I've seen thus far is 7000rps on 4 cores (makes all the difference, given that I can't seem to otherwise push CPU use to the max.).

Incidentally luafcgid is eating CPU at ~6% when idle (on OS X, anyway).