lua-users home
lua-l archive

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


On Sat, 21 Jul 2007 16:21:49 +1000 (EST)
Duck <duck@roaming.ath.cx> wrote:

> Well, you might be writing a "serious" server using blocking I/O and 
> multiple threads, e.g. with LuaTask, instead of using non-blocking
> I/O and coroutines, e.g. with COPAS. (If very high concurrency is not
> an issue, both approaches are programmatically appropriate --
> different strokes for different folks.)
no, you'd better not write something `serious' and `longuptimed' with
LuaTask. at least with LuaTask 1.6.1 (sorry, Daniel). a wrote an http
proxy server in Lua with LuaSocket and LuaTask. that server segfaults
after 18-20 hours of working (and it never has more than 16-20 tasks
working simultaneously).

i got an interesting conversation with Diego and now i rewrote
everything to non/blocking i/o. i didn't notice any speed issues, but
the server working about 4 days w/o any crashes. and code becomes
smaller (it's probably due to per-ip traffic shaping, which is easier
to do in one task with coroutines than in separate LuaTasks which must
communicate %-).

the very early version of proxy with LuaTask is on luaforge. i'll
upload a new version soon. i just want to clean the code before
uploading. basically i wrote a LuaSocket wrapper object which does
internal buffering (and calls yield() here and there, so working with
this wrapper is 90% the same as with the ordinary socket). and i
rewrote receive("*l") in Lua with my buffering code. one can write
other line-oriented functions, the code is simple i think.


i don't want to use COPAS or so, because i'm writing the proxy for
myself and want not only result, but the process to be fun too. %)