Monday, February 6, 2012

OSB Clustering & Load Balancer

OSB clustering is being used to run multiple servers in parallel and to provide failover in case any managed server fails. Load Balancer is being used to effectively distribute the request payload among the running managed server in cluster depending upon the algorithm being used ( by default round robin ).

I will make use of Software Load Balancer (HTTP proxy servlet ) inbuilt in weblogic server as the implementation is being is done to simulate in clustering and load balancing in development or testing environment for the HTTP requests.
For production environment Hardware Load Balancer like BIG IP  ..are being used.

Architecture would be like :






 1. Domain Creation


    2.  Do Select Oracle Service Bus and not OSB for developer's

    3. 



    4. 



    5. 
    6. 

    7. Add managed server ip and port no in cluster address  (127.0.0.1:7201, 127.0.0.1:7301)


    8. Add only osb1 & osb2 to osbcluster


    9. Add the third managed server as Proxy server 



     10.

    11.Add all to machine 



    12.  Finished the setup and start admin server.

    13. Start managed server osb1


    14. Start managed server osb2


    15. Start managed server lb (load Balancer) 


    16. Go Service Bus Console and check the server health 


    17. Load a wsdl and make a proxy on it, add a log action( to check which managed server the request is going ) to capture the request payload and do reply with success 

    18. Go to weblogic console to check the clustering setup  : 


     Go to deployments under weblogic home, you will find the encircled app which is handling the load      balancing 



    19. Just enter 
                        http://[managed server ip address]:[managed server port no]/yourproxyurl?wsdl   
    You will find a wsdl published but have endpoint pointing to loadbalancer ip and port no 



    20. Now i have used soap-ui to test the load balancing 

    My request would be hitting load balancer  and load balancer would be handling the distrubution among osb1 and osb2 

    keep a look in the endpoint being hit in soap-ui 
    a.                      http://127.0.0.1:7101/default/PS_LoadBalancerTest

    First time the request has gone to osb1 as we can see in logs of osb1 managed server 

     b: I again tested it from soap-ui then the request would go to osb2 as we can see in logs of osb2 managed server (green)

    • If you shutdown admin server, still the request can be fulfilled by osb1 and osb2 . 
    • If any of osb1 or osb2 is down then request would be re-directed to running managed server either osb1 or osb2.
    • If you shutdown load balancer managed server (lb) then request won't be fulfilled you need to point your request to osb1 or osb2 by changing the endpoint                                                                                                http://[managed server ip address]:[managed server port no]/yourproxyurl.

    So the osb clustering and load balancing is achieved in simple manner !!