lua-users home
lua-l archive

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


On Sunday 18, Gerry Weaver wrote:
> Hello All,
> 
> 
> I'm looking at rewriting a web application server framework that I wrote in
> C a few years ago in Lua (as much as possible). It's basically a framework
> for testing various web server designs (ie; evented, threaded, pipeline, 
> app specific etc.) I'm trying to decide if I should write the request
> parser in pure Lua or do an ffi binding to the C code. I've read about
> instances where pure Lua can actually offer a performance benefit over the
> Lua/C combination. Has anyone had any experiences where a comparison could
> be made between the two approaches? It would take some time to create a
> reasonable test, so I was hoping for some advice on how to proceed.
> Performance in this case is pretty important, so I would probably go with
> the approach fills that requirement best. The overall goal is to make
> writing test designs quicker and easier.

It would be hard for a pure Lua parser to out perform a parser written in C 
like the one used in nodejs [1].

There is a HTTP parser [2] for Lua that has good performance it uses the same 
C HTTP parser as nodejs does.

There is also a HTTP server module in my lua-handlers [3] which uses an event 
loop (lua-ev [4]) to handle many concurrent connections.  I have done test 
with more then 50,000 concurrent connections and am working on improving the 
performance even more.  I hope to release a new version of lua-handlers with 
some new features in the next week or two.

1. https://github.com/joyent/http-parser
2. https://github.com/brimworks/lua-http-parser
3. https://github.com/Neopallium/lua-handlers
4. https://github.com/brimworks/lua-ev

-- 
Robert G. Jakabosky