Scripting Nginx with Lua (2012)
londonlua.org
Scripting Nginx with Lua (2012)
1–10 of 23 posts
Re: Scripting Nginx with Lua (2012)
#2Re: Scripting Nginx with Lua (2012)
#3All this usually just requires a few lines of code and due to the nature of OpenResty, it scales really well and is very lightweight in terms of CPU consumption and memory.
I haven't really used it for anything bigger yet, mostly because then I'd rather prefer Django or Clojure (depending on the tasks) as they have much more functionality / packages for web development.
Particularly the nonblocking IO for db/file/networking operations (out of the box) is neat. Another interesting aspect is that, once you've set up the system, development feels a lot like PHP development, where every lua file can be one page and changing the file results in a direct change on the frontend (if you turn the lua code cache off).
On the other hand, there're some pitfalls, the project is young, it still lacks packages for many, many things (notably, if you want to do crypto, you have to FFI right into the C library, for now. There's a new sha/hmac module, but it's not part of the current OpenResty distribution yet). Also, sometimes it is difficult to find solutions to problems, as it is not widely used as Django or Rails. If you're interested in using it, take some time to read up on LuaJIT as there're several important optimization techniques to really get the best out of it (see below).
All in all, for smaller projects, I love the stack as it is simple, lightweight, and easy to install.
Here're some useful links:
Lua(Jit) Profiler: https://github.com/jgrahamc/lulip/
IDE With Debugger for OpenResty (Pretty cool, you can debug while your browser requests): http://notebook.kulchenko.com/zerobrane/debugging-openresty-...
LuaJIT Performance Guide: http://wiki.luajit.org/Numerical-Computing-Performance-Guide
Lua Performance Guide: http://www.lua.org/gems/sample.pdf
Re: Scripting Nginx with Lua (2012)
#4Re: Scripting Nginx with Lua (2012)
#5Open Source on GitHub: https://github.com/Mashape/mashape-agent
Re: Scripting Nginx with Lua (2012)
#6Re: Scripting Nginx with Lua (2012)
#7(not the author, just a fan!)
Re: Scripting Nginx with Lua (2012)
#8Re: Scripting Nginx with Lua (2012)
#9If you'd like to go a bit higher level without sacrificing performance, I suggest Lapis, a Lua/Moonscript framework built on top of OpenResty: http://leafo.net/lapis/ (not the author, just a fan!)
Re: Scripting Nginx with Lua (2012)
#10Off topic, but does anyone know what software was used to make/generate the slides webpage?