Private libraries and modules which are included in the subscription of OpenResty XRay
lua-resty-tls-session
lua-resty-tls-session is a Lua library for the rotation of TLS session ticket keys.
The TLS session ticket key in the Nginx configuration file is used to generate TLS session tickets. The client uses the session ticket to resume the previous session with the server without a new handshake. However, if the ticket key is not changed for a long time and is leaked, there is a security issue. The security requirements can be met by periodically changing the ticket keys in the configuration file and restarting the Nginx process. However, this approach is very cumbersome for operations and maintenance, and restarting causes brief business interruptions, which is unacceptable for services with high SLA levels.
In addition, for multiple Nginx servers in a cluster, the same ticket key must be configured, otherwise, client requests switching between different servers will cause servers to fail to decrypt the session ticket. The session cannot be restored then. In this case, a new SSL/TLS handshake is required, which can result in very high additional CPU overhead.
Using the lua-resty-tls-session library, you can dynamically update the key in Nginx by specifying keys_fetcher to get the latest key at regular intervals and eliminate expired keys without restarting the Nginx process.
We also provide a built-in redis_fetcher. As long as the cluster uses the same redis_fetcher configuration, they can share these ticket keys. The client-side can resume sessions with all servers in the cluster using a valid session ticket which improves session reuse on both the client and server sides.
lua-resty-jsonb
lua-resty-jsonb
is a solution for manipulating and storing JSON data instead of lua-cjson
. It greatly reduces the creation of GC objects by avoiding serialization and deserialization operations without changing existing data structures.
As lua-resty-jsonb does not require deserialization to query JSON data, it is particularly suitable for replacing lua-cjson when frequent deserialization is required or when only a few subobjects of a large object are queried.
For example, you can generate a JSONB object on control plane machines and distribute that JSONB object to all data plane machines. The machines data plane machines can then query data inside the JSONB without deserialization.
lua-cjson-plus
JSON is often used to exchange messages and store configurations because of its easy-to-read format. In practice, there is often a need to encode and decode a large number of JSON objects, and these operations consume a lot of CPU resources.
The JSON encoding/decoding library lua-cjson has been widely used in OpenResty service. Therefore, OpenResty Inc. has fully optimized the lua-cjson software to improve the efficiency of encoding and decoding JSON data.
In many cases, performance can be up to 4
times that of the open-source library.
The installation and usage instructions of the library can be found in this document.
lua-resty-http-plus
Some businesses make heavy use of lua-resty-http to send HTTP requests. OpenResty Inc. has made a number of optimizations to improve the performance of this library.
luajit-plus
luajit-plus is the LuaJIT engine optimized by OpenResty Inc.
The software has the following features
- The performance of operations on tables of luajit-plus private library can be improved thousands of times under some scenarios compared to open-source LuaJIT.
- luajit-plus private library also provides more operation symbols, such as +=, -=, %=, etc.
- Support expression-level
do end
statement.
The installation and usage instructions of the library can be found in this document.
lua-resty-redis-fast
This software is a high-performance Redis client library implemented by OpenResty Inc. based on C coroutines. The library’s interface is consistent with that of the open-source lua-resty-redis and allows for fast substitution.
The library offers higher performance with less memory overhead than lua-resty-redis. In some cases, performance can be up to 2.5 times that of the open-source library.
lua-resty-redis-cluster-fast
This software is a high-performance Redis client library implemented by OpenResty Inc. based on C coroutines. It adds support for Redis clustering compared to lua-resty-redis-fast
. The installation and usage instructions of the library can be found in this document.
lua-resty-memcached-fast
This is a high-performance memcached client library implemented by OpenResty Inc. based on C coroutines. The library’s interface is aligned with that of the open-source lua-resty-memcached, allowing for fast replacements.
This library offers higher performance and less memory overhead than lua-resty-memcached.
lua-resty-dymetrics
Open source metrics statistics modules such as nginx-module-vts suffer from severe performance degradation in the case of multiple workers, which in turn affects the business and are therefore not suitable for production environments with high traffic.
OpenResty Inc. implements a high-performance metrics module based on lock-free programming, which can output metrics results in JSON format or Prometheus format, and is suitable for docking with various legacy collection systems. The module also has excellent performance in high-traffic situations. The installation and usage instructions of the library can be found in this document.