lua-resty-nonblocking-ffi provides an efficient and generic API to do hybrid programming in openresty with mainstream languages (Go, Python, Java, etc.).
In fact, this library has been used successfully by several commercial companies for over two years. My customers come from different domains, including AI, IOT, Edge computing. Now I plan to open source it for use by the community. Features: * simple but extensible interface, supports any C ABI compliant language * once and for all, no need to write C/Lua codes to do coupling anymore * high performance, 3~4 times faster than unix domain socket way * bridges for python/java, once and for all * any serialization message format you like Background: In openresty land, when you turn to implement some logic, especially to couple with third-party popular frameworks, it's likely to suck in awkward: make bricks without straw. 1. C is a low-level language, very little ecosystem, no unified and rich libraries, and almost all modern frameworks do not support C, instead, they like Java, Python, Go. For example, when you need to do grpc to access external services, you must depend on C++ lib, which is huge and cumbersome. 2. Lua is an embedded and minority programming language, which means all the powers comes from the host. In openresty, it means all functionalities come from lua-nginx-modules. Like C, or even worse, you have to reinvent the wheels via cosocket to do modern networking stuff. A lot of lua-resty-* were born, but they are almost semi-finished compared to native lib in other languages. For example, lua-resty-kafka doesn't support consumer groups, lua-resty-postgres doesn't support notify and prepared statements, etc. Moreover, most of those authors of lua-resty-* stop development at some stage because the lua community is so small and less attractive. To implement a common function in other mainstream languages, you have to do a lot of adaptive coding back and forward between nginx and openresty. For example, http2 requires SNI and viable session reuse, then you have to patch C codes and openresty and/or nginx. Moreover, when you turn to accomplish a new job, you need to redo all such things again! Then, a lot of *-nginx-module born and recompile your nginx! Painful, right? May I extend the openresty with modern programming languages (Go, Python, Java, etc.) and reuse their rich ecosystems directly? That means, we reserved everything from those mainstream languages and let them work together with Nginx at ease.