I have been using OpenResty for years now. The ability to run Lua scripts from within is great.<p>Story time: Some time ago we developed a CMS for a large art/production company. One of the requirements was that everything must be access controlled including all assets (eg. images, videos). The site went live and all was good until one day when, for no apparent reason, our monitoring alreted extreme load and then the site went down. Not so good for a company that sells its tickets online... I got on the phone with them and turns out that they started using the CMS to store images used for newsletters, which they sent out to some 200K people that morning. Now normally this wouldn't be such a big problem, but since all images were ACLd, this meant that instead of serving static files all requests went to the backend and pretty much killed it. The solution we came up with was to move the initial access control check for assets directly to OpenResty using Lua and Drizzle. So whenever a request came in for an image Openresty checked if it's public and only if it was not did the request hit the backend, otherwise it was served directly. Once we pushed this live the load disappeared and never came back.<p>Also I wrote an init script for it (as we needed one for a DRBD setup). Maybe someone will find it useful, here it is:
<a href="https://gist.github.com/pwm/d3260804b4ade0d81f29" rel="nofollow">https://gist.github.com/pwm/d3260804b4ade0d81f29</a>