
Lead Image © Kirill Kurashov, 123RF.com
The OpenResty distribution for Nginx
Secret Agent's Suitcase
OpenResty [1] is the Nginx server [2] bundled with many useful modules. Developed almost single-handedly by Yichun "agentzh" Zhang while living and working in Beijing, China, then San Francisco, California, OpenResty converts Nginx into a superfast web application server.
The majority of OpenResty comprises modules for the Lua scripting language, which is popular as an embedded language because of its low resource consumption and good performance. The Apache web server has also added Mod-Lua to its core distribution [3].
The OpenResty modules make it possible to use Lua instructions in the configuration files. This allows for complex and dynamic configurations, which can be used, say, to implement web services. The distribution includes some modules for integrating memcache and databases such as MySQL/Drizzle, PostgreSQL, and Redis.
Lua Included
With OpenResty, Lua scripts can intervene in all stages of processing and editing an HTTP request, creating responses, and modifying headers. The combination of Lua and Nginx and the event-based request processing characteristic of Nginx places OpenResty high in TechEmpower's web framework benchmarks (Figure 1) [4], and it is even faster with the Lua just-in-time compiler (LuaJIT) included with OpenResty.
...