lua-users home
lua-l archive

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


On Tue, Dec 6, 2011 at 11:20 AM, Tim Caswell <tim@creationix.com> wrote:
> As far as interfacing with blocking C libraries (like database
> clients) libuv has a thread-pool made just for this.

great, didn't know that.

then i guess the common problem of Node.js applications where a single
blocking task hangs the whole server is only laziness to delegate
that task out of the common thread.


> It's used
> internally for filesystem operations since there are very few truly
> async filesystems in the world.  It also exposes a generic API for
> wrapping blocking calls and putting them in the thread pool.

if Luvit re-exposes that API, it might be easier to have a background
thread to go on secondary loop.  I've done similar contraptions with
HTT.


> This is
> not a good solution for anything network related. Threads are very
> expensive, especially the locking.

you'd be surprised...  I know single-threaded servers can be really
high performance, but there are times where the best (and cheapest!)
solution is to keep a few locked threads.

-- 
Javier