Find Blocking Go Code Paths Holding back CPU Usage (Using OpenResty XRay)
The OpenResty official APK repositories provide the following Alpine APK packages.
This is the production build for the core OpenResty server.
This package registers
/usr/bin/openresty, which is symbolic link to OpenResty's
openresty command should be visible to your
environment by default. Always type
openresty instead of
nginx when you want to invoke the nginx
executable provided by this package. The
nginx executable is not visible to your
by default, however, to avoid any confusions with other NGINX packages and installations in the same
You can also start the default OpenResty server via the command
sudo rc-service openresty start
Other service actions supported are 'checkconfig
, and upgrade`.
The default server prefix is
/usr/local/openresty/. For your own OpenResty applications, it is highly
recommended to specify your own server prefix and point it to your own application directories, like this:
sudo openresty -p /opt/my-fancy-app/
Then you have sub-directories like
logs/ under the
This way, we can avoid polluting the OpenResty installation trees under
/usr/local/openresty/ and allow
multiple different OpenResty applications sharing the same OpenResty server installation. You will need
to edit the
/etc/conf.d/openresty file to point to your new nginx configuration file and server prefix
path if you want to reuse the OpenRC services. Or you can make separate init scripts for each of your
OpenResty application yourself using the files
/etc/conf.d/openresty as templates.
This package contains the
resty command-line utility, which is visible to your
PATH environment (as
/usr/bin/resty. To try it out, just type
$ resty -e 'ngx.say("hello")' hello
This package depends on the standard
perl package and our
openresty package to work properly.
See the resty-cli project for more details.
This package contains the OpenResty documentation tool chain and documentation data. The most useful tool
restydoc command-line utility, which should be visible to your
PATH environment by default (as
To try it out:
restydoc ngx_lua restydoc -s content_by_lua restydoc -s proxy_pass
See the output of the
restydoc -h command for more details on its usage.
For the best result, please ensure your terminal is using the UTF-8 character encoding and both of your
groff installations are modern enough. Otherwise those non-ASCII characters may not be displayed
This package contains the command-line utility opm for OpenResty Package Manager. This tool can be used to install community-contributed OpenResty packages from the central OPM package server:
This is the normal debug build of OpenResty. As compared to the
openresty package, it has the following
- It disables C compiler optimizations in the build.
- It enables the NGINX debugging log capability.
- It enables the poll module in NGINX in addition to the default epoll module so that the mockeagain testing tool can be used.
- It uses the
openresty-openssl-debugpackage instead of
openresty-opensslfor the OpenSSL library.
- It enables API checks and assertions in the LuaJIT build.
- It enables the assertions in the
- It makes the
ngx_http_luamodule abort the current nginx worker process immediately upon LuaJIT allocation failures in its GC-managed memory (the default behavior is logging an error message and gracefully quit the current worker process).
- The default server prefix of its NGINX is
- The entry point visible to your
- It does not come with a init script.
You should never use this package in production. This package is for development only.
This package also comes with an OpenRC init scripts, as in
sudo rc-service openresty-debug start
This is our own build of the OpenSSL library. In particular, we have disabled the threads support in the build to save some overhead.
We include our own (small) patches to support advanced SSL features in OpenResty like ssl_session_fetch_by_lua.
Also, we ship our own OpenSSL package to ensure the latest mainstream version of OpenSSL is used in OpenResty even on older systems.
This is the debug build of the OpenSSL library. As compared to
openresty-openssl, it has the following changes:
- It disables any C compiler optimizations.
- It is Valgrind clean and free of any Valgrind false positives.
- Assembly code is disabled so we always have perfect C-land backtraces and etc.
- It is installed into the prefix
This is our own build of the zlib library for gzip compression. We ship our own zlib package to ensure the latest mainstream version of zlib is used in OpenResty even on old systems.
This is our own build of the PCRE library for gzip compression. We ship our own PCRE package to ensure the latest mainstream version of PCRE is used in OpenResty even on older systems.
This package provides the command-line utility, lemplate, that can compile template files in perl's TT2 templating language syntax to standalone Lua modules for OpenResty.
The OpenResty official site, openresty.org, uses Lemplate as the HTML page template compiler, for example.
This is our Test::Nginx test framework. Read the following book chapter on a complete introduction to this test scaffold:
This package is already shipped by the official Alpine community repository so we do not bother packaging it ourselves.
We provide development packages for our binary library packages
openresty-openssl-debug. These packages contain header files or the corresponding
binary package. Their names all have a
-dev suffix as compared to their binary counterpart. For example, we have
openresty-opnessl, and also
We provide debuginfo (or debug symbol) packages for those containing binary components like the
openresty-openssl packages. Their
debuginfo packages just have the
-dbg suffix in their package names, just like other standard APK packages.
For example, to install the debuginfo package for the
openresty package, just install the
openresty-dbg package. Similarly, the debuginfo package for the
openresty-debug package is
The source files used to build these packages can be found in the
openresty-packaging GitHub repository:
See the Linux Packages page for more details on our official OpenResty package repositories.
More Interesting Topics
How we solved a CPU bottleneck caused by Lua exceptions in a custom Kong plugin (using OpenResty XRay)