关于使用redis+websocket+openresty时openresty与后端redis并发连接数的疑问

174 views
Skip to first unread message

stone

unread,
Jan 22, 2017, 2:09:31 AM1/22/17
to openresty
大家好! 春哥好!
我在使用redis+websocket+openresty做一个推送方案的时候遇到个openresty与redis连接数的问题或者说是疑问
nginx与客户端每建立一个websocket连接后就需要去订阅某个channel的消息,每个redis的订阅者就意味着与redis建立了一条tcp连接,这就意味着nginx与websocket的连接数和后端与websocket的边接数是1:1的关系了,
我实测了好像就是这样的 ,每新建一个websocket连接就会多个redis的连接,这样不是会把redis搞挎吗?请问用openresty就是会这样还是说我实现的不对?

瞿秋丰

unread,
Jan 23, 2017, 10:23:13 PM1/23/17
to openresty
用这个 https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/semaphore.md 

在 2017年1月22日星期日 UTC+8下午3:09:31,stone写道:

stone

unread,
Feb 6, 2017, 10:37:04 PM2/6/17
to openresty
thanks , 这个可以做到多request间共享redis连接?

在 2017年1月24日星期二 UTC+8上午11:23:13,瞿秋丰写道:
Reply all
Reply to author
Forward
0 new messages