8 ms·
Lwan, a high-performance web server with Lua support
- gradschool 11y agoIt seems like a cool project with a nice clean coding style, but the lack of API documentation makes it less inviting. I'm sitting here grepping through the repo without much of an idea of what to try next besides reading the whole code base.
- ArnoldP 11y agoI'm certainly not in the market for a webserver with lua support, but if I were I would definitely be looking at nginx first. May I suggest that you make a subsection/table that delineates why someone would go for this rather than nginx? There is a section that says that if you think of apache/nginx first then that {nginx/apache} is probably best for you, but I think lumping in apache and nginx together may be a mistake, and even if I'm giving preferential treatment to nginx I may be swayed nonetheless.
- deleted 11y ago[deleted]
- deleted 11y ago[deleted]
- poelzi 11y agoI think it targets embedded machines which is actually quite nice in c + lua. openwrt uses this combo.
- GaiusCoffee 11y agoLwan, a backronym for "Lwan Will Annihilate Node.js". Cheeky.
- robbles 11y ago> Hand-written HTTP request parser Aren't they all hand-written?
- gmmeyer 11y agoYea, I'm not sure why that's a benefit, either. It's like they're trying to sell stuffed animals on Etsy, "hand sewed."
- acidx 11y agoThat's not the only joke in the feature list (or the whole page, to be honest.)
- wmf 11y agoA few years ago Ragel was all the rage: http://zedshaw.com/archive/ragel-state-charts/ http://zedshaw.com/archive/ragel-state-charts/
- grayrest 11y agoMore or less. There was a minor parser combinator arms race in the Rust community a few months ago using http parsing as the benchmark and my takeaway (only half paid attention, I haven't needed to write a parser) was that they got to roughly as fast as handwritten C parsers. Example: https://github.com/Geal/nom_benchmarks/tree/master/http https://github.com/Geal/nom_benchmarks/tree/master/http This hasn't translated into actual use in the Rust HTTP libs with hyper and rotor-http using their own handwritten parsers but I still think it might.
- cordite 11y agoIs the name a take on that phony gwan server? (It seemed fast, but it absolutely did not respect unique sessions when I bench'd it.)
- acidx 11y agoKind of. I've tried making the page just as phony, but that's more difficult than it sounds.
- ludamad 11y agoThe C API can be used from Lua with LuaJIT, right? It seems like this is the way to go to create the bindings.
- acidx 11y agoIt's possible with FFI, yes, but it's not the way it's currently done in Lwan.
- rdtsc 11y agoHa, I remember when we picked nginx because it was small, fast and simple years ago (compared to Apache). It is interesting how the cycle repeats. This is the new fast and simple, kind of what nginx started with.
- VeejayRampay 11y agoDoesn't really work with nginx though, a webserver that it still extremely fast and simple.
- diskcat 11y agoIs Lua the new in vogue programming language?
- otabdeveloper 11y agoLua has been the standard extension language in gamedev and adtech for years and years.
- wmt 11y agoIt was in the 90s, especially after the Dr Dobbs article about it, and tons of late 90s and early 2000s games, like Grim Fandango, Baldurs Gate and Escape from Monkey Island used Lua due to its hotness.
- ewmailing 11y agoActually, Grim Fandango was the very first known game to use Lua and wasn't due to any hotness. Bret Mogilefsky, who against skepticism, dared to try to create a new scripting engine to replace the aging SCUMM engine. He was given the Dr. Dobbs article by a colleague and things came together. After the technical success of Grim Fandango, it was applied to Escape from Monkey Island. A few years(?) later at GDC, there was a 2 hour session to discuss scripting in games. Near the end, after everybody was depressed with no viable solutions, Bret's colleague exclaimed, "Or you can do what Bret did" and he was dragged up on stage. Bret gave an impromptu spiel about what Lua was and how they used it at LucasArts. Everybody else frantically scribbled down notes and that was how the video game industry adopted Lua as the dominant game scripting language. *Source: Bret Mogilefsky's talk at the very first Lua Workshop in 2005
- haberman 11y agoLua is a simple and only slightly quirky (1-based arrays) dynamic programming language. It has exceptionally small and high quality implementations in Lua and LuaJIT. It has very good documentation. Its main downside is that the language changes in backward-compatible ways between releases. And worse, LuaJIT has in some sense forked the language. Lua 5.3 introduced integer support, but there are no plans to add this to LuaJIT AFAIK.
- gravypod 11y agoThe C interface looks really well made. I might try and play around with this to make a few microservices.
- vbit 11y agoLinux only - bummer. Not even FreeBSD. The turbolua.org project is somewhat similar (i.e. a webserver with Lua support).
- geocar 11y agoReplacing the epoll() with kevent() looks pretty straightforward if you want to try it out, but FreeBSD should be able to do other tricks as well (e.g. http filters)
- acidx 11y agoIt builds on FreeBSD (soon OS X), but it's not working yet.
- mhd 11y agoWhich is why most "competitors" go for libevent (or libuv), as that abstracts over all the various select(3) improvements.
- luastoned 11y agoTurbo does not just support Lua, it's actually written with it.
- foota 11y agoI think the easy c interop is kind of neat.
- mingodad 11y agoWith a small code base there is also h2o and it already has http2 and a very good https performance (can serve around twice as much than nginx). After looking for most of available http servers h2o is my preferred one right now. Also I have a fork of h2o compiled as C++ (right now it cleans a bit redundancy/verbosity of C) and add SquiLu and Lua scripting (h2o comes with mruby only). https://github.com/h2o/h2o https://github.com/h2o/h2o https://github.com/mingodad/h2o https://github.com/mingodad/h2o https://github.com/mingodad/squilu https://github.com/mingodad/squilu
- KenanSulayman 11y ago... however, my h2o servers get a lower score with Qualys SSL Labs in their default configuration than Nginx does. This is due to the fact that h2o seems to support ciphers per default that are considered less secure (according to Qualys SSL Labs while testing servers using h2o).
- mingodad 11y agoInteresting point, so it's using a dirty trick to show it as more performant ?
- rurban 11y agoNope. More insecure Ciphers are marginally slower than modern ones.
- mingodad 11y agoI've looked at h2o website and seems that someone asked this question and there is an example of a stronger configuration. Using it I did a test on a raspberry pi 3 and here https://gist.github.com/mingodad/e5a46c809ee030befc18 https://gist.github.com/mingodad/e5a46c809ee030befc18 is the output. What I noticed is that with nginx there is more connections even using keepalive (h2o 4 connections, nginx 102 connections). h2o-default: 4123 rps h2o-strong-256-first: 3849 rps h2o-strong-384: 4233 rps nginx-default: 2309 rps
- nvus 11y agoIs Lwan a good project for a C beginner to learn more about C and contribute?
- dschiptsov 11y agoIt has been made with great deal of attention to details and code quality, so yes, it is a good one.
- jedisct1 11y ago"Does it support HTTP2? -> Not yet" Ok, back to Nginx/H2O/Caddy.
- xyproto 11y agoAlgernon supports both Lua and HTTP/2. Written in Go. http://algernon.roboticoverlords.org/ http://algernon.roboticoverlords.org/
- ruffrey 11y agoInteresting. Someone used lwan as a replacement for the Node.js HTTP server https://github.com/raadad/node-lwan https://github.com/raadad/node-lwan
- mtw 11y agoInterestingly, Lwan is the fastest server for json serialization : https://www.techempower.com/benchmarks/#section=data-r12&hw=peak&test=json https://www.techempower.com/benchmarks/#section=data-r12&hw=... This could be a great choice as a json server, if they showed more examples working with data stores (postgres or cloud data stores) and also testing
- tmaly 11y agoI started out using Apache and now I am on Nginx. I like the simplicity of the configuration of Nginx along with the great documentation and modules. It would be a hard sell for me to switch to Lwan. My sites are not getting 300k connections all at once.
- nickpsecurity 11y agoFinally a nice, open-source answer to Barracuda: http://barracudaserver.com/ http://barracudaserver.com/ Or closer to one, anyway. Support for RTOS's like QNX and INTEGRITY puts it ahead in a big way. Someone might port this to GenodeOS, MINIX 3, or something similar. Nonetheless, it's a start that might save someone some money. If it's well-done internally, it might also be easy to port to other languages or secure CPU's in development. That rids us of need for garbage collection or JIT.