Find Blocking Go Code Paths Holding back CPU Usage (Using OpenResty XRay)
We are happy to announce the new formal release, 22.214.171.124, of the OpenResty web platform based on NGINX and LuaJIT.
The (portable) source code distribution, the Win32/Win64 binary distributions, and the pre-built binary Linux packages for Ubuntu, Debian, Fedora, CentOS, RHEL, Alpine, OpenSUSE, Amazon Linux are provided on this Download page.
On the Intel Core i9-9900K CPU test environment, with the simple Lua Hello world interface, we can increase the QPS of a single worker from 221,939 rps to 269,423 rps, with a 20%+ improvement.
- Upgraded the nginx core to 1.19.3.
- Upgraded the LuaJIT, synchronized code from the official LuaJIT repository.
- Now we recycle lua thread GC objects for our "light threads".
- Added new Lua API functions
thread.exdata2as well as C API funcs
lua_setexdata2, and reduced the time complexity of lookup meta info within a single request concatenation from O(n) to O(1).
- Avoided use of
ngx_http_lua_calc_strlen_in_tableand other APIs which may result in the creation of unnecessary gc objects.
ngx.ctxamong SSL_* phases and the following phases.
exit_worker_by*to run Lua code upon nginx worker process exit.
- Added the
balancer.recreate_requestfunction, which allows user to recreate request buffer in balancer phase.
- Implemented the new
ngx.ssl.server_port()API to get server port.
- Now we detect SSE 4.2 instruction set support at runtime in our LuaJIT to support older Intel and AMD CPUs without this instruction set with the same LuaJIT binary, otherwise binaries built on newer hardware would not work on older CPUs due to the "Invalid instruction" CPU exception.
ngx.flush(true)Lua API can now work properly for HTTP 2.0 requests.
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:
We also always run our OpenResty Edge commercial software based on the latest open source version of OpenResty in our own global CDN network (dubbed "mini CDN") powering our openresty.org and openresty.com websites. See https://openresty.com/ for more details.
See the Community Page.
Commercial technical support and real-time noninvasive online monitoring and profiling solution is provided through the official OpenResty XRay product.
More Interesting Topics
How we solved a CPU bottleneck caused by Lua exceptions in a custom Kong plugin (using OpenResty XRay)