[ANN] lua-resty-upstream - TCP connection load balancing and failover

980 views
Skip to first unread message

Hamish Forbes

unread,
Jan 16, 2014, 7:50:46 AM1/16/14
to openre...@googlegroups.com
Hi All,

I've been working on a module to allow load balancing and failover for the ngx.socket.tcp api with dynamically configurable pools of hosts.
The aim is to provide similar, or better, functionality compared to the nginx upstream and proxy modules but in pure lua.


I've also created a wrapper for James Hurst's lua-resty-http (https://github.com/pintsized/lua-resty-http) module,
providing nearly the same interface as lua-resty-http but with failover based on HTTP response status codes as well as socket connection failures.
The repo contains an example http load balancer / proxy config, which in initial testing performs at least as well as the native nginx upstream and proxy modules.

Currently only random round-robin load balancing has been implemented as we have no real world use for sticky sessions,
however sticky sessions are planned as a future feature along with active health checks (both HTTP and TCP).

It's possible to pass in any of the lua-resty-* modules which implement connect and set_keepalive,
this gives you connection load balancing and failover for lua-resty-redis, lua-resty-memcached etc etc.

Any suggestions, thoughts or criticisms are most welcome!

Thanks
Hamish

Brian Akins

unread,
Jan 16, 2014, 2:14:37 PM1/16/14
to openre...@googlegroups.com
Very nice! I've written a few versions of such things for projects, so it should be good to have a general use one in the community.

Louie Kwan

unread,
Nov 29, 2015, 10:53:23 PM11/29/15
to openresty-en
I am looking for a module to allow TCP load balancing for a while as well. Have you taken a look at the following:


You mentioned about a wrapper, how can we access it?

Can you share more what should be done to get lua support with openresty to get dynamic backend configuration without going to the Nginx Plus path?

Thanks.
Louie
Reply all
Reply to author
Forward
0 new messages