openresty / lua-nginx-module

Embed the Power of Lua into NGINX HTTP servers
https://openresty.org/
11.3k stars 2.03k forks source link

Implement listen() and accept() methods on stream-typed cosockets #1021

Open agentzh opened 7 years ago

agentzh commented 7 years ago

We need a nonblocking implementation for the listen() and accept() methods on the stream-typed sockets to allow individual NGINX worker processes to listen on some port or local unix domain socket files.

This will open the door for efficient inter-process communications and control-flow synchronizations among NGINX worker processes.

ArthurJiang commented 6 years ago

Hi Yichun,

How about this issue now? It's really a good feature. I just meet the performance issue when I use redis as an inter-process communications channel. Just get 3333 rps, which is not good enough, and I only use redis pub/sub fire event, use share dict for data sharing(it's not the limitation, in my case). I try to use cosocket listen and accept, but it's failed. Do you have some advice, or do you have partially finished code I can reference?

Thx, Arthur

ArthurJiang commented 6 years ago

I use this lib(https://github.com/slact/ngx_lua_ipc) as a workaround, achieve 100 times faster result, from 3.3k rps to 330k rps, which only be used to transfer event among workers.