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.
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