Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic front-end interface for ngx_lua #179

Closed
ghost opened this issue Nov 22, 2012 · 8 comments
Closed

Generic front-end interface for ngx_lua #179

ghost opened this issue Nov 22, 2012 · 8 comments

Comments

@ghost
Copy link

ghost commented Nov 22, 2012

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
Copy link
Member

agentzh commented Nov 22, 2012

Hello!

Maybe you want to take a look at the ngx_tcp_lua module prototype done by
bigplum (Simon):

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

You can check out his original announcement on the openresty mailing list
(it was in Chinese though):

http://groups.google.com/group/openresty/browse_thread/thread/cfd7da68d9a30182

I hope I can merge his work with ngx_http_lua_module at some point to
eliminate code duplication as much as possible.

Best regards,
-agentzh

@ghost
Copy link
Author

ghost commented Nov 22, 2012

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
Copy link
Member

agentzh commented Nov 22, 2012

Hello!

On Thu, Nov 22, 2012 at 12:13 AM, simpl.it notifications@github.com wrote:

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.

Yes, that's the way to go :)

Best regards,
-agentzh

@ghost
Copy link
Author

ghost commented Nov 22, 2012

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
Copy link
Member

agentzh commented Nov 23, 2012

Thank you in advance! :)

@deltay
Copy link

deltay commented Sep 29, 2015

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

@agentzh
Copy link
Member

agentzh commented Sep 29, 2015

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

@agentzh
Copy link
Member

agentzh commented Feb 16, 2016

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 as completed Feb 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants