Generic front-end interface for ngx_lua #179

Closed
simpl opened this Issue Nov 22, 2012 · 8 comments

3 participants

@simpl

Have you considered the idea of creating a front-end socket configuration for ngx_lua (i.e. an interface on which ngx_lua can accept incoming connections)? Thus any type of server could use the power of ngx_lua, not just an HTTP(S) one, sort of in a similar way to Node.js.

It could be implemented in a top-level lua { ... } block (instead of the http {} block, and there could be similar server {} blocks, with core settings like listen, buffer sizes etc could be set in the config file but the large part of the processing could be done by Lua, including all the header parsing.

I'm fairly sure it would then probably be possible to implement an HTTP server that was quite a bit quicker than Nginx, but I can also see other possibilities. You could create your own Memcached/Redis implementation, perhaps performing some kind of cluster management while keeping the logic away from the connecting service.

@agentzh
OpenResty member
@simpl

https://github.com/bigplum/nginx-tcp-lua-module

Yeah, that's basically the idea I had in mind, except that using 'tcp' conflicts with the tcp proxy module (which I actually use in one of my projects). I would probably just switch to using ngx_tcp_lua, though, so it wouldn't be a problem.

What might be a good way to go is to make the interfaces generic ngx_xxx_lua interface, which can then be used by both ngx_http_lua and ngx_tcp_lua, with an extra interface wrapper where needed around the API stuff.

@agentzh
OpenResty member
@simpl

I'll try to help you out with this porting at some stage. I can't right now, but maybe some time in the new year.

@agentzh
OpenResty member
@deltay

Since nginx stream module is open source now, it there any plan to add stream lua support in ngx_lua module ?

@agentzh
OpenResty member

@deltay Yes, it's on the TODO list and the development work is expected to begin (and finish) in Q4.

@agentzh
OpenResty member

The ngx_stream_lua_module is now available for testing:

https://github.com/openresty/stream-lua-nginx-module

Feedback welcome!

Since this module already allows what this ticket was asking for, I'm closing this.

@agentzh agentzh closed this Feb 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment