Load balancing with an Undertow subsystem
Considering the fact that we have two running undertow instances, we will configure a WildFly application server Undertow subsystem to act as a load balancer in the following section.
Start two instances of the beosbank-undertow-service
project using the following:
$mvn exec:java -Dundertow.port=7071 $mvn exec:java -Dundertow.port=7072
Download, install, and run a WildFly application server in standalone mode:
unzip $HOME/Downloads/wildfly-11.0.0.Alpha1.zip cd wildfly-11.0.0.Alpha1/bin $ ./standalone.sh
WildFly is now running and listening on port 9990
; connect to the server using jboss-cli
, as follows:
./jboss-cli.sh --connect
For Undertow to act as a static load balancer behind a set of backend systems, we must register remote socket bindings for these backend systems:
[standalone@localhost:9990 /] /socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=node1/:add(host=localhost,port=7071) {"outcome" => "success"} [standalone...