InfraCityOpen editor

Load balancing

Spread requests over identical servers, and stop sending to the ones that stop answering.

Load balancing, drawn as an isometric city

The CityScript

This is all there is to it. Change it in the editor and the city redraws.

%% L · Load balancing
%% A TCP balancer in front, an HTTP balancer behind it, and health probes that pull sick servers out of rotation.
city 48x32

district front "Balancers" 3,3..14,14
district pool "Web pool" 19,3..45,16

building l4 tower in front "L4, TCP"
  floor l4.f "HAProxy"
    room l4.ha proxy "HAProxy" port=80,443
    room l4.health worker "Health probes"
building l7 tower in front "L7, HTTP"
  floor l7.f "Envoy"
    room l7.envoy proxy "Envoy" port=8080
    room l7.rules config "Routing rules"
building web-1 factory in pool "Web 1"
  floor web-1.f "Server"
    room web-1.app service "App" port=3000
building web-2 factory in pool "Web 2"
  floor web-2.f "Server"
    room web-2.app service "App" port=3000
building web-3 factory in pool "Web 3"
  floor web-3.f "Server"
    room web-3.app service "App, draining" port=3000

gate users at 0,8 port=443 "Public"
link l4.ha -> l7.envoy "TCP" variant=emphasis
link l7.rules -> l7.envoy "routes"
link l7.envoy -> web-1.app "HTTP" variant=emphasis
link l7.envoy -> web-2.app "HTTP" variant=emphasis
link l7.envoy -> web-3.app "draining" variant=dashed
link l4.health -> web-1.app "probe" variant=dashed
link l4.health -> web-2.app "probe" variant=dashed
link l4.health -> web-3.app "probe" variant=dashed