lua-nginx-module icon indicating copy to clipboard operation
lua-nginx-module copied to clipboard

Proposal: Hybrid programming with lua-resty-ffi

Open kingluo opened this issue 3 years ago • 2 comments

lua-resty-ffi provides an efficient and generic API to do hybrid programming in openresty with mainstream languages (Go, Python, Java, Rust, Node.js, etc.).

Features:

  • nonblocking, in coroutine way
  • 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, faster than unix domain socket way
  • generic loader library for python/java
  • any serialization message format you like

Please refer to: https://github.com/kingluo/lua-resty-ffi

Also, check this blog post for more descriptions:

Implement Grpc Client in Rust for Openresty

Chinese blog

I hope I could merge this library into openresty. It's meaningful to extend the ecosystem of openresty. Thanks. @agentzh @zhuizhuhaomeng

kingluo avatar Dec 10 '22 09:12 kingluo

FYI Proposal: Hybrid programming with lua-resty-ffi This also works for openresty, except that the envoy main thread is replaced by the nginx main thread.

kingluo avatar Mar 22 '24 01:03 kingluo

Some thoughts on contributing lua-resty-ffi to openresty.

lua-resty-ffi consists of 4 parts:

  1. a small nginx patch, commit this file to openresty repo?
  2. ngx_http_lua_ffi.c, commit this file to lua-nginx-module repo?
  3. resty_ffi.lua, commit this file to lua-resty-core repo?
  4. loaders for Java, Python, and Nodejs.

As said before, I really hope lua-resty-ffi can be merged into openresty. @agentzh @zhuizhuhaomeng Please revise and make suggestions, thank you.

kingluo avatar Mar 22 '24 02:03 kingluo