This project is using Zuul as a reverse proxy for a Wicket backend. Cause Wicket doesn’t work with a load balancer when using the REDIRECT\_TO\_BUFFER strategy we have to use sticky sessions to redirect the user to the same instance. I’ve found a vaadin demo project which uses a custom round robin rule which is reused in this project.
Zuul can be used with Eureka to automatically detects the running instances. This project uses hard coded URLs in the application.properties. To check if the instances are up and running the Netflix PingUrl class is used. PingUrl checks if a specific URL of each instance is available. If not the server is removed from the list of available servers and is not used for load balancing.
For the session replication Spring Session is used with hazelcast as a provider. So if you’re logged in on one instance you’re logged in on all instances.
The last missing thing is the page store which also have to be clustered. In this project Wicketstuff Datastore Hazelelcast is used so that each instance shares the same page stores.
Zuul : mvn spring-boot:run -f cluster-zuul/pom.xml -Dserver.port=8080
Wicket Instance 1 : mvn spring-boot:run -f cluster-wicket/pom.xml -Dserver.port=8081
Wicket Instance 2 : mvn spring-boot:run -f cluster-wicket/pom.xml -Dserver.port=8082
If you shutdown one instance all users which are sticked to that instance are 'load balanced' to another instance.