Alexander Gladysh wrote:
Stefan, a great thing that luafcgid can do is "process"-management, with
watchdogs, restarting of processes that go AWOL, etc., things that
wsapi-fcgi currently delegates to an external tool (mod_fcgid, lighttpd,
spawn-fcgi+a process monitor, etc.). A rock-solid FastCGI daemon for Lua
scripts would be very useful. You might get some ideas from the Ruby folks
and their Unicorn web server (Unicorn speaks HTTP instead of FastCGI, but
the general idea is applicable, IMHO).
I'm looking closely at the Unicorn as well.
This article is insightful: http://tomayko.com/writings/unicorn-is-unix
Unicorn looks like is a good model for a Lua web-server.
Alexander.
Yes, I have been mulling over this all weekend.
Is there a greater demand for a Unicorn/php-fpm style fastcgi process
manager? If you set luafcgid to 1 worker thread and (let's say) 5
states, then run a couple of them - you have basically a redundant,
multiplexed, single-threaded Lua FastCGI server.
I tested it and it runs fine, just uses significantly more memory:
1 luafcgid process w/10 threads and 50 states:
5828K total, 1384K resident
10 luafcgid processes w/1 thread and 5 states each:
46760K total, 12600K resident
On a 256MB slicehost (for example), that is starting to get painful. But
the latter setup allows servicing 10 simultaneous requests on older
Apache mod_fastcgi and other "serialized" fastcgi clients, where the
multi-threaded one requires a more modern and compliant web server. I
know first hand that nginx supports it. I am testing it with Apache 2.x
today:
==========
multiplex-test.lua
----------
function main(env, req)
-- do nothing for a sec
os.execute("sleep 1")
req:puts("done")
end
----------
With 10 worker threads and nginx, "ab -c 10 -n 10
http://x.x.x.x/multiplex-test.lua" gives almost 10 rps, each one taking
just over 1 sec. If any take 2 secs or more, then the webserver is
serializing requests.
I could perhaps shift gears and make a Lua-fpm. This would be a parent
process that fires off off multiple child processes - each one being a
FastCGI server & Lua state manager with housekeeping (luafcgid with only
one worker thread).
Thoughts?
_______________________________________________
Kepler-Project mailing list
Kepler-Project@lists.luaforge.net
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/