[ANN] ngx_openresty mainline version 1.4.3.7 released

Yichun Zhang (agentzh) agentzh at gmail.com
Sun Dec 15 00:42:32 UTC 2013


Hello folks!

I am happy to announce that the new mainline version of ngx_openresty,
1.4.3.7, is now released:

    http://openresty.org/#Download

Thanks all our contributors for making this happen!

The highlights of this release are the new LuaJIT v2.1 engine and the
lua-resty-core library.

You should observe immediate speedup in your existing OpenResty/Lua
apps after upgrading to this version. Sometimes the speedup can be 40%
overall, as observed in CloudFlare's Lua WAF system. Sometimes it may
just be 10%, as observed in CloudFlare's Lua CDN system. Thanks to all
the new improvements in LuaJIT v2.1, especially the improvements in
the JIT compiler; Mike Pall is my hero ;) Special thanks go to
CloudFlare for kindly sponsoring 3 development phases in LuaJIT v2.1
(and phase #4 is also coming!).

The lua-resty-core library reimplements many Lua API functions
provided by the ngx_lua module with LuaJIT FFI, which means user Lua
code paths using these API functions can finally be JIT compiled by
LuaJIT (they used to be interpreted by LuaJIT's interpreter only). So
enabling lua-resty-core like below in nginx.conf may give another
speedup in your Lua applications:

    init_by_lua '
        require "resty.core"
    ';

Loading the resty.core module will replace a lot of ngx_lua's Lua API
functions with resty.core's own FFI-based implementations. So you can
easily compare the performance with and without lua-resty-core :)
Enabling lua-resty-core in CloudFlare's Lua WAF system gives another
33% ~ 37% overall speedup. Whee!

But if your don't have enough Lua code paths (actually) JIT compiled,
you MAY observe slowdown after enabling lua-resty-core. So always
benchmark the performance of your app before enabling lua-resty-core
in production. Or just resolve or workaround the blockers in your Lua
code paths that cannot be JIT compiled, with the aid of LuaJIT's jit.v
or jit.dump modules. To use LuaJIT's jit.v or jit.dump modules to
analyze your Lua apps running in OpenResty/Nginx, you can put the
following lines into your nginx.conf's http {} block:

    init_by_lua '
        local verbose = false
        if verbose then
            local dump = require "jit.dump"
            dump.on("b", "/tmp/jit.log")
        else
            local v = require "jit.v"
            v.on("/tmp/jit.log")
        end

        require "resty.core"
    ';

And load your app with tools like ab and weighttp to get your Lua code
hot (for LuaJIT's JIT compiler). Then you can check the outputs in the
file /tmp/jit.log for all the detailed information from the JIT
compiler.

Below is the complete change log for this release, as compared to the
last (stable) release, 1.4.3.6:

 *   upgraded LuaJIT to v2.1-20131211.

     *   see changes here:
         https://github.com/agentzh/luajit2/commits/v2.1-agentzh

 *   bundled LuaRestyCoreLibrary 0.0.2.

     *   this library reimplements LuaNginxModule's Lua API with
         LuaJIT FFI. see https://github.com/agentzh/lua-resty-core
         for more details.

 *   upgraded LuaNginxModule to 0.9.3.

     *   feature: added a lot of pure C API (without using any Lua
         VM's C API) for FFI-based Lua API implementations like
         LuaRestyCoreLibrary.

     *   feature: allow creating 0-delay timers upon worker process
         existing.

     *   feature: added new API function ngx.worker.exiting() for
         testing if the current worker process has started exiting.

     *   feature: ngx.re.find() now accepts the optional 5th argument
         "nth" to control which submatch capture's indexes are
         returned. thanks Lance Li for the feature request.

     *   feature: added new API for version numbers of both Nginx and
         LuaNginxModule itself: ngx.config.nginx_version and
         ngx.config.ngx_lua_version. thanks smallfish for the patch.

     *   feature: added support for loading LuaJIT 2.1 bytecode files
         directly in *_by_lua_file configuration directives.

     *   bugfix: ngx.req.set_header() did not completely override the
         existing request header with multiple values. thanks Aviram
         Cohen for the report.

     *   bugfix: modifying request headers in a subrequest could lead
         to assertion failures and crashes. thanks leaf corcoran for
         the report.

     *   bugfix: turning off lua_code_cache could lead to memory
         issues (segfaults and LuaJIT assertion failures) when Lua
         libraries using LuaJIT FFI were used. now we always create a
         clean separate Lua VM instance for every Nginx request
         served by us when the Lua code cache is disabled. thanks Ron
         Gomes for the report.

     *   bugfix: the linker option "-E" is not support in Cygwin's
         linker; we should test "--export-all-symbols" at the same
         time. thanks Heero Zhang for the report.

     *   bugfix: fixed the warnings from the Microsoft Visual C++
         compiler. thanks Edwin Cleton for the report.

     *   optimize: optimized the implementation of ngx.headers_sent a
         bit.

     *   doc: added new section "Statically Linking Pure Lua
         Modules":
         https://github.com/chaoslawful/lua-nginx-module#statically-l
         inking-pure-lua-modules

     *   doc: typo fixes from Zheng Ping.

 *   upgraded HeadersMoreNginxModule to 0.24.

     *   bugfix: more_set_input_headers did not completely override
         the existing request header with multiple values. thanks
         Aviram Cohen for the report.

 *   upgraded SetMiscNginxModule to 0.23.

     *   feature: added new configuration directives
         set_formatted_gmt_time and set_formatted_local_time. thanks
         Trurl McByte for the patch.

 *   upgraded MemcNginxModule to 0.14.

     *   feature: added new configuration directive
         memc_ignore_client_abort. thanks Eldar Zaitov for the patch.

 *   upgraded RdsJsonNginxModule to 0.13.

     *   bugfix: fixed the warnings from the Microsoft Visual C++
         compiler. thanks Edwin Cleton for the report.

 *   upgraded EchoNginxModule to 0.50.

     *   bugfix: fixed the warnings from the Microsoft Visual C++
         compiler. thanks Edwin Cleton for the report.

 *   upgraded ArrayVarNginxModule to 0.03.

     *   bugfix: fixed the warnings from the Microsoft Visual C++
         compiler. thanks Edwin Cleton for the report.

 *   upgraded RedisNginxModule module to 0.3.7.

     *   see changes here:
         <http://mailman.nginx.org/pipermail/nginx/2013-December/041297.html>

 *   feature: applied the larger_max_error_str patch to the nginx
     core to allow error log messages up to 4096 bytes and to allow
     the C macro "NGX_MAX_ERROR_STR" to be overridden from the
     outside.

 *   feature: added new configure option
     "--with-pcre-conf-opt=OPTIONS" to the nginx core to allow custom
     PCRE ./configure build options. thanks Lance Li for the original
     patch.

The HTML version of the change log with lots of helpful hyper-links
can be browsed here:

    http://openresty.org/#ChangeLog1004003

OpenResty (aka. ngx_openresty) is a full-fledged web application
server by bundling the standard Nginx core, lots of 3rd-party Nginx
modules and Lua libraries, as well as most of their external
dependencies. See OpenResty's homepage for details:

    http://openresty.org/

We have run extensive testing on our Amazon EC2 test cluster and
ensured that all the components (including the Nginx core) play well
together. The latest test report can always be found here:

    http://qa.openresty.org

Have fun!
-agentzh



More information about the nginx mailing list