Lwan, a high-performance web server with Lua support
lwan.ws
lwan.ws
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
nginx-default: 1067 rps
h2o-strong-384: 1009 rps
Ok, back to Nginx/H2O/Caddy.
The turbolua.org project is somewhat similar (i.e. a webserver with Lua support).
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.
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
It would be a hard sell for me to switch to Lwan. My sites are not getting 300k connections all at once.
Aren't they all hand-written?
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.
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
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.
Isn't this what most scripting languages do? I know it's the case with Python and PHP.
And I disagree about the 1-based array indexing. With algorithms that require a lot of 1-off values, it can be a huge pain in the ass, particularly if you're trying to integrate it with C (and its 0-based array indexing). Still not sure why the creators chose it, given that Lua was designed for easy and close C interop.
http://www.inf.puc-rio.br/%7Eroberto/talks/ws2011.pdf
Excerpt:
- Not all languages are 0-based: Icon, Fortran, AWK1, and Smalltalk are 1-based; Snobol, Pascal, Modula, Modula-32, and Ada have configurable bases.
- Currently, many languages are 0-based due to influence from C.
- Ironically, none of them share the reason that made C 0-based (where a[e] means *(a+e)).
1-based arrays:
- Much more intuitive: first is 1st (not 0th). ISO-C: “E1[E2] designates the E2-th element of E1 (counting from zero).”
- Much easier for non programmers. Easy for (good) programmers :)
- Historical reason: Fortran used 1-based arrays, and most first users of Lua had a Fortran background.
This is false for Python:
>> print bla
NameError: name 'bla' is not defined
In Lua:
> = bla
nil
setmetatable(_G or _ENV, {__index = error})
-- `error` for the example, you can write a function that prints a better error message. >>> def f(a):
... pass
...
>>> f()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: f() takes exactly 1 argument (0 given)
>>>
I agree 1-based indexing isn't ideal, but in the grand scheme of things, the default nils and the method/function syntax are a constant source of mistakes and frustration for me. In Lua you have to call `obj:method()` which to pass `obj` as the first argument. If you accidentally do `obj.method()` - there is no error, but the first argument becomes `nil`.In Python, there the call syntax is consistent and `obj` is automatically passed as the first argument for methods.
s/first/last/, the arguments will be shifted to the right. But yes, it can be annoying.
And Wikipedia (Wikimedia) uses Lua for their multimedia scripting engine. Besides good performance, the implementation was good and small enough that it could be audited for security.