With Lua you will find many examples how to interact (non-blocking) with mysql, Lua also contains a load balancer which can be adapted to loadbalance sql instances. See also https://www.google.nl/#q=nginx+lua+mysql Posted at Nginx Forum: https://forum.nginx.org/read.php?2,272718,272719#msg-272719