lua-users home
lua-l archive

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


If you prefer coding with OS threads\shared memory over user threads or multiprocessing, there is also a Lua binding to the Apache Portable Runtime [1] that works and should be plenty fast

[1] http://peterodding.com/code/lua/apr/ 

On Tue, Jul 12, 2011 at 5:16 AM, David Hollander <dhllndr@gmail.com> wrote:
> The project is a kind of communication hub connected to anything from 0 to 2k+ users at a time, some kind of multi threading feels like a must :D

2k+ users is no problem for Xavante, Copas, or the libev binding used in Lua-ev or Lua-handlers, they all get around 8000 requests/s on my laptop.
Additionally if you need something more lightweight I have a server here that gets around 13000 requests/s: https://github.com/davidhollander/ox

For comparison, on the same laptop nginx serving static page also gets around 13000rq/s serving , the Tornado asynchronous server for CPython gets around 5000 rq/s, the default server in Racket (scheme) gets around 4000rq/s.

2k users should be no problem for a single Lua process, you should probably just use whatever you feel most comfortable developing with.


On Tue, Jul 12, 2011 at 4:26 AM, Gaspard Bucher <gaspard@teti.ch> wrote:


On Tue, Jul 12, 2011 at 4:14 AM, James Graves <james.c.graves.jr@gmail.com> wrote:

With 2000+ users, this sounds more like a job for 0MQ (www.zeromq.org).  It has a well supported Lua binding too.

James Graves

I second James: keep Lua single threaded if you can and use a producer/consumer pattern. If 0MQ seems overkill, use some producer/consumer code in C but keep the Lua_State single-threaded in the consumer thread. 0x threading example (http://lilja.asteriski.fi/~sharlin/procon.cpp).



--

                                                               Gaspard