balancer_by_lua里面如何使用lua-resty-rock?

65 views
Skip to first unread message

Gordon Gao

unread,
Aug 24, 2016, 1:39:22 AM8/24/16
to openresty
在balancer_by_lua出来之前我们自己实现了一个使用shared_dict和lua-resty-lock的upstream balancer。balancer_by_lua出来以后我们想用,但是发现在balancer_by_lua里面不能使用lua-resty-lock,因为ngx.sleep似乎不能在balancer_by_lua里面。这背后有什么技术原因以及workaround吗?

DeJiang Zhu

unread,
Aug 24, 2016, 10:19:06 AM8/24/16
to open...@googlegroups.com
Hello

你可以在 rewrite 阶段拿到节点信息(包括重试节点),在 balancer 阶段来 set_current_peer

在 2016年8月24日 下午1:39,Gordon Gao <ghpr...@gmail.com>写道:
在balancer_by_lua出来之前我们自己实现了一个使用shared_dict和lua-resty-lock的upstream balancer。balancer_by_lua出来以后我们想用,但是发现在balancer_by_lua里面不能使用lua-resty-lock,因为ngx.sleep似乎不能在balancer_by_lua里面。这背后有什么技术原因以及workaround吗?

--
--
邮件来自列表“openresty”,专用于技术讨论!
订阅: 请发空白邮件到 openresty+subscribe@googlegroups.com
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+unsubscribe@googlegroups.com
归档: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
教程: http://openresty.org/download/agentzh-nginx-tutorials-zhcn.html

Reply all
Reply to author
Forward
0 new messages