Hi all,需求场景:or收到一个请求,解析body,解析body后,根据内容,使用ngx.thread+resty.http发起多个请求,最后获取多个响应后组装返回。目前使用lua-resty-http可以完成基本需求,美中不足的是发起多个请求时最好支持负载均衡。了解到可以使用https://github.com/hamishforbes/lua-resty-upstream,但还不确定其性能和稳定性如何,不知道大家还有更好的办法?谢谢!
可以使用 ngx_lua 的 balancer_by_lua,结合 nginx conf 里配置的 upstream 做负载均衡。或者使用 upyun 的 lua-resty-checkups https://github.com/upyun/lua-resty-checkupsOn Tuesday, November 21, 2017 at 4:39:27 PM UTC+8, Tim kiwi wrote:Hi all,需求场景:or收到一个请求,解析body,解析body后,根据内容,使用ngx.thread+resty.http发起多个请求,最后获取多个响应后组装返回。目前使用lua-resty-http可以完成基本需求,美中不足的是发起多个请求时最好支持负载均衡。了解到可以使用https://github.com/hamishforbes/lua-resty-upstream,但还不确定其性能和稳定性如何,不知道大家还有更好的办法?谢谢!
请问resty http如何与nginx conf的upstream结合起来?难道是用location封装proxy_pass?On Tuesday, November 21, 2017 at 4:42:45 PM UTC+8, tokers wrote:可以使用 ngx_lua 的 balancer_by_lua,结合 nginx conf 里配置的 upstream 做负载均衡。或者使用 upyun 的 lua-resty-checkups https://github.com/upyun/lua-resty-checkupsOn Tuesday, November 21, 2017 at 4:39:27 PM UTC+8, Tim kiwi wrote:Hi all,需求场景:or收到一个请求,解析body,解析body后,根据内容,使用ngx.thread+resty.http发起多个请求,最后获取多个响应后组装返回。目前使用lua-resty-http可以完成基本需求,美中不足的是发起多个请求时最好支持负载均衡。了解到可以使用https://github.com/hamishforbes/lua-resty-upstream,但还不确定其性能和稳定性如何,不知道大家还有更好的办法?谢谢!
可以参考下 balancer_by_lua_block https://github.com/openresty/lua-nginx-module#balancer_by_lua_block以及 ngx.balancer https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ssl.mdOn Tuesday, November 21, 2017 at 5:00:59 PM UTC+8, Tim kiwi wrote:请问resty http如何与nginx conf的upstream结合起来?难道是用location封装proxy_pass?On Tuesday, November 21, 2017 at 4:42:45 PM UTC+8, tokers wrote:可以使用 ngx_lua 的 balancer_by_lua,结合 nginx conf 里配置的 upstream 做负载均衡。或者使用 upyun 的 lua-resty-checkups https://github.com/upyun/lua-resty-checkupsOn Tuesday, November 21, 2017 at 4:39:27 PM UTC+8, Tim kiwi wrote:Hi all,需求场景:or收到一个请求,解析body,解析body后,根据内容,使用ngx.thread+resty.http发起多个请求,最后获取多个响应后组装返回。目前使用lua-resty-http可以完成基本需求,美中不足的是发起多个请求时最好支持负载均衡。了解到可以使用https://github.com/hamishforbes/lua-resty-upstream,但还不确定其性能和稳定性如何,不知道大家还有更好的办法?谢谢!
不太明白。。。balancer_by_lua这个我使用过,做动态upstream还可以,但与cosocket怎么结合用搞不懂。。On Tuesday, November 21, 2017 at 5:13:23 PM UTC+8, tokers wrote:可以参考下 balancer_by_lua_block https://github.com/openresty/lua-nginx-module#balancer_by_lua_block以及 ngx.balancer https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ssl.mdOn Tuesday, November 21, 2017 at 5:00:59 PM UTC+8, Tim kiwi wrote:请问resty http如何与nginx conf的upstream结合起来?难道是用location封装proxy_pass?On Tuesday, November 21, 2017 at 4:42:45 PM UTC+8, tokers wrote:可以使用 ngx_lua 的 balancer_by_lua,结合 nginx conf 里配置的 upstream 做负载均衡。或者使用 upyun 的 lua-resty-checkups https://github.com/upyun/lua-resty-checkupsOn Tuesday, November 21, 2017 at 4:39:27 PM UTC+8, Tim kiwi wrote:Hi all,需求场景:or收到一个请求,解析body,解析body后,根据内容,使用ngx.thread+resty.http发起多个请求,最后获取多个响应后组装返回。目前使用lua-resty-http可以完成基本需求,美中不足的是发起多个请求时最好支持负载均衡。了解到可以使用https://github.com/hamishforbes/lua-resty-upstream,但还不确定其性能和稳定性如何,不知道大家还有更好的办法?谢谢!
这个我也想到过,估计效率会很差,目前可以想到的是直接封装成kong的插件使用kong提供的balancer或者封装下tcp:connect加上使用lua-resty-dns-client做dns负载均衡,我之前提到ua-resty-upstream也可以,但不确定效率如何。
hi,或许你可以用本机的Nginx做负载,然后对localhost发起http请求。On Tuesday, November 21, 2017 at 4:39:27 PM UTC+8, Tim kiwi wrote:Hi all,需求场景:or收到一个请求,解析body,解析body后,根据内容,使用ngx.thread+resty.http发起多个请求,最后获取多个响应后组装返回。目前使用lua-resty-http可以完成基本需求,美中不足的是发起多个请求时最好支持负载均衡。了解到可以使用https://github.com/hamishforbes/lua-resty-upstream,但还不确定其性能和稳定性如何,不知道大家还有更好的办法?谢谢!