3 ms·
Is there a framework for writing asynchronous servers with Lua?
by Tichy 16y ago
Is there a framework for writing asynchronous servers with Lua?
- moonpolysoft 16y agohttp://keplerproject.github.com/copas/ http://keplerproject.github.com/copas/
- silentbicycle 16y agoI don't think that's what Tichy meant. That's just a wrapper library to make error handling easier in a coroutine-based event loop. If you're not worried about being "web scale", it's not hard to write an async socket server using luasocket's sockets for nonblocking TCP IO and luasocket.select for scanning for active connections. It gets bogged down once you have > 100 or so idle connections (the usual trade-offs with select apply), but it's easy to write, very portable, and (on x86) LuaJIT is amazingly fast. Contact me if you want example code. I've been working on an actual framework for async servers (libev-based), but haven't had much free time lately.
- silentbicycle 16y agoWorking on it. Libev-based. It's a spare-time project of mine. I have the "portable but not particularly scalable" pure Lua and luasocket backend done (for easy development + light deployment on Windows), working on the error handling in the libev backend now. Much of the complexity comes from error handling, not just the async IO. Erlang gets that right, too. I don't know how much error handling node.js does. (I plan on checking it out eventually, since my framework will be compared to it.) I don't have a time frame yet. I'm also working on a compiler and a bunch of other stuff, and I'm really not a web developer, so it's been a fairly low priority.