4 ms·
To courious web nerds: currently both Nginx and HAproxy have got Lua scripting modules to extend themselves by implementing e.g. customized filtering, routing,
by imhoguy 8y ago
To courious web nerds: currently both Nginx and HAproxy have got Lua scripting modules to extend themselves by implementing e.g. customized filtering, routing, caching, proxing, storage etc. One can even build a full featured web app backend in embedded Lua tied to Nginx.
- fosk 8y agoDisclaimer: I am CTO of Kong. If you want to look at a large OpenResty/Lua application from a code perspective you could take a look at Kong[1] - which is the most popular public codebase built on top of NGINX/Lua at the moment. CloudFlare also uses the same stack but most of their codebase is proprietary. What really makes Nginx/Lua a good combination is primarily LuaJIT[2] support, a much faster implementation of the Lua VM. [1] - https://github.com/Kong/kong https://github.com/Kong/kong [2] - http://luajit.org http://luajit.org
- sgt 8y agoWhat made you choose Lua instead of say, embedding Python into nginx? I can think of a few good reasons like embeddability, code size, simplicity but it would be interesting to hear your take on this.
- ufo 8y agoLuajit is pretty fast
- minxomat 8y agoCan't speak for Kong, but I'm currently working on creating a microservice in lapis (using moonscript). The speed of the underlying OpenResty server, as well as lapis ergonomics make this really fun. I guess the only practical reason I can see is the async everything without clutches approach, as well as the truly impressive TTFB. For me, day 1 productivity is really high, comparable to Nancy, the framework I was using before.
- tybit 8y agoRedis and Envoy also have the same. It seems to be the scripting lingua franca for interacting with native code.
- cmsj 8y agoShameless plug: I maintain an open source Mac app called Hammerspoon that opens up a ton of OS frameworks/events to a Lua environment for your scripting/automation pleasure :)