0 Replies Latest reply on Jan 14, 2016 2:05 AM by Adrian Farmadin

    Invm-http and mod_cluster

    Adrian Farmadin Newbie

      Hi,

      This is a follow-up to https://developer.jboss.org/thread/249311. I tried to configure Wildfly in standalone mode to use Invm-http and to simultaneously act as mod_cluster load balancer and as node. The benefit will be, that my client service doesn't need to know where other services are located and I don't need to configure a proxy location. We can call web services on other hosts without configuration.


       

      A working example of my configuration with better description how mod_cluster and invmhttp should work together: https://github.com/AdrianFarmadin/modcluster-invmhttp-example


       

      I encountered a problem during my setup. If a Wildfly instance is configured as mod_cluster load balancer and as node at the same time, then a request will create an infinite loop.


       

      For example: we have two Wildfly servers Node1 and Node2. Both servers are configured as mod_cluster load balancers and as nodes at the same time. We deploy application Client.war on both servers. If we call this application on Node1, then the request will be handled first by mod_cluster load balancer running on Node1. Because the application is deployed on both servers the balancer will choose Node2 server and forward the request. Node2 load balancer will choose Node1 and forward the request to it. Now we get an infinite loop. This loop is create because all requests are first handled by mod_cluster load balancer.


       

      I found two possible solutions to this problem:

      - Order http handlers by priority in such a way: When a service is available locally on the server, then it's processed directly by the server and not sent to load balancer. ( I did not manage to get this option working.)

      - mod_cluster balancer has a list of all nodes with this service available. If this list includes the local node, then pass the request to the next handler. The request will be processed locally. ( To get this option working I made some changes to undertow https://github.com/AdrianFarmadin/undertow )


       

      Could you help me find the best solution for my problem? Do you see a possibility to include this code into the official Undertow release?