Consul balancer for Openresty/Nginx

Roman Vynar
The Quiq Blog
Published in
1 min readAug 5, 2022

Today we would like to opensource our Consul balancer LUA code which can be used with Openresty, a free nginx alternative with LUA module, for service discovery and load balancing on the discovered addresses.

Check this out: https://github.com/Quiq/lua-consul-balancer

We are using this implementation at Quiq for 4 years or so and it is very fast and reliable with even 50 services in total and multiple addresses per each one. It doesn’t produce much load on Openresty if any at all.

This is also a good replacement of “Internal Load Balancer” resource from AWS or any other cloud provider especially if you use Hashicorp Consul and rely on it for service discovery. There is no reason to do a discovery on the network level of ports and instances if you can straight point your web server proxy_pass directive to one of the addresses being discovered.

Thanks!

--

--