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 !!








    38 comments:

    1. Hi Abhinav

      When am trying to install managed server for load balancer , i am getting error while creating domain "

      Preparing...
      Extracting Domain Contents...
      Creating Domain Security Information...
      Domain Creation Failed!

      Domain Location: D:\Oracle\Middleware\user_projects\domains\base_domain

      Reason: null

      Exception:

      Traceback (innermost last):
      File "", line 56, in ?
      TypeError: iteration over non-sequence
      .


      Please help in resolving the issue.

      ReplyDelete
    2. Plese share the logs and screens to trace the error.

      ReplyDelete
    3. Hi abhinav


      Below is the log that i can see in MIDDLEWARE_HOME/logs/wlsconfig_20120924141936.log file.

      com.oracle.cie.domain.aspect.XBeanConfigAspect - Unable to locate property:Name on type:class com.oracle.cie.domain.xml.configxb.weblogic.x90.impl.WeblogicJmsTypeImpl
      2012-09-24 14:25:24,056 ERROR [create_gui] com.oracle.cie.wizard.domain.gui.tasks.DomainCreationGUITask - Generation Error!!
      Traceback (innermost last):
      File "", line 56, in ?
      TypeError: iteration over non-sequence

      at org.python.core.Py.TypeError(Unknown Source)
      at org.python.core.PyObject.__iter__(Unknown Source)
      at org.python.pycode._pyx25.f$0(:56)
      at org.python.pycode._pyx25.call_function()
      at org.python.core.PyTableCode.call(Unknown Source)
      at org.python.core.PyCode.call(Unknown Source)
      at org.python.core.Py.runCode(Unknown Source)
      at org.python.util.PythonInterpreter.execfile(Unknown Source)
      at org.python.util.PythonInterpreter.execfile(Unknown Source)
      at com.oracle.cie.domain.script.ScriptHelper.executeEmbeddedTemplateScript(ScriptHelper.java:1571)
      at com.oracle.cie.domain.DomainChecker.executeEmbeddedScript(DomainChecker.java:1322)
      at com.oracle.cie.domain.DomainChecker.runCustomWLSTScript(DomainChecker.java:1305)
      at com.oracle.cie.domain.DomainChecker.preprocessOutput(DomainChecker.java:143)
      at com.oracle.cie.domain.DomainGenerator.generate(DomainGenerator.java:269)
      at com.oracle.cie.wizard.domain.gui.tasks.DomainCreationGUITask$1.run(DomainCreationGUITask.java:216)

      ReplyDelete
      Replies
      1. Hi,

        I have faced the same error in 2010 as far as my poor memory remembers

        **** at org.python.core.Py.TypeError(Unknown Source.) ****

        The above error was a result of environment variable set already ( for some other app ) before installing OSB and creating domain (JAVA_HOME or PATH variable pointing to java jdk).

        try to remove all user/system variables pointing to java jdk or jre.

        That time it worked for me.
        Try to check both User Variable and system variable.

        Let me know did it worked.

        Delete
    4. Hi Abbhinav,

      Good material. I would like to ask you regarding the service pool usage in OSB. Do you think it is a best practice to use the service pool option provided in OSB for load balancing or just pass the request to the external hardware load balancer which load balances the downstream business services.

      Regards

      IMU

      ReplyDelete
      Replies
      1. Hi IMU ,

        Service pool usage in OSB :

        If you have a service & you expect to receive heavy usage you may want to consider introducing multiple instances of the service(downstream business services) i.e. multiple service endpoints and distributing service requests across them in order to share the workload using load balancing algorithms such as Round robin/Random/Random weighted.
        Useful in order to Mark an Endpoint URI Offline Temporarily.
        http://docs.oracle.com/cd/E17904_01/doc.1111/e15867/endpointurimgmt.htm

        External hardware load balancer:

        Is being used to distribute the workload across multiple resources/instances(downstream business services.

        If you need to throttle the request going to downstream business services, then you can enable Throttling in OSB to achive the same.
        https://blogs.oracle.com/knutvatsendvik/entry/throttling_in_osb


        Regards,
        Abhinav Gupta

        Delete
    5. When am trying to install managed server for load balancer , i am getting error while creating domain "

      Preparing...
      Extracting Domain Contents...
      Creating Domain Security Information...
      Domain Creation Failed!

      Domain Location: D:\Oracle\Middleware\user_projects\domains\base_domain

      Reason: null

      Exception:

      Traceback (innermost last):
      File "", line 56, in ?
      TypeError: iteration over non-sequence

      same error occured in windows 7
      i set system variable path added this C:\Program Files\Java\jdk1.6.0_24\bin\
      there is no other jdk or user java_home variable path

      ReplyDelete
      Replies
      1. Hi

        Are you adding an additional manager server after creation of initial domain.

        Manager server assignment to load balancer should be happen during the initial domain creation and not during the domain upgrade( like adding an additional managed server.)

        Abhinav

        Delete
      2. 1. Create Managed servers
        lb Middleware/user_projects/domains/lb
        osb1 Middleware/user_projects/domains/osb1
        osb2 Middleware/user_projects/domains/osb2
        3. Create Cluster Domain
        ClusterDomain Middleware/user_projects/domains/ClusterDomain

        how can i start managed server's my local ?

        Delete
      3. Creating Managed server osb1

        1. Select Domain Source
        ----- Oracle Service Bus 11.1.1.6 [Oracle_OSB]
        ----- Weblogic Advanced Web Services for JAX-RPC Extensio - 10.3.6.0 [wlserver_10.3]
        ----- Oracle JRF - 11.1.1.0 [oracle_common]
        2. Specify Domain Name and Location
        ----- Domain name: osb1
        3. Configure Administrator User Name and Password
        ----- Name: weblogic
        ----- User Password: weblogic123
        4. Configure JDBC Component Schema
        ----- DEV_SOAINFRA selected

        5. Select Optional Configuration
        ----- Administration Server not checked
        ----- Managed Servers, Clusters and Machines not checked

        6. Created


        is that right creatig process osb1 managed server ?

        Delete
      4. Hi,

        Few Abbreviations needed to clear before using :

        Domain Name : ClusterDomain
        Admin Server : AdminServer port 7001
        Managed Server First : osb1 port 7201
        Managed server Second : osb2 port 7301
        Managed Server Third : lb ( load balancer managed server ) port 7101

        You have been confused in between domain and managed server naming..
        See the step 5.

        What you are doing is domain creation like osb1 above ... not managed server

        To create managed server follow step 2 to Step 13 in proper sequence.


        Delete
      5. create lb, osb1, osb2 domain using 2 -12 step and not step 4, 5

        is that right ?

        Delete
      6. Hello
        lb osb1 osb2 are managed server name and not the domain names.
        There is only single domain created by name of ClusterDomain with three managed server in it (lb osb1 & osb2)

        So don't get bewildereed between domain name and managed server name

        Delete
      7. step 2 is development mode created fine

        Delete
    6. hi
      Adminserver
      http://127.0.0.1:7001/osb-101-helloworld/HelloWorld?wsdl
      http://127.0.0.1:7001/sbconsole working fine

      and --- osb1
      http://127.0.0.1:7301/sbconsole not working
      http://127.0.0.1:7301/osb-101-helloworld/HelloWorld?wsdl

      why is not working ?

      ReplyDelete
      Replies
      1. Hi

        SB Console will run only on Admin Server Port i.e. 7001

        Delete
      2. hi
        how can i access osb1 service or enable ?
        127.0.0.1:7201/osb-101-helloworld/HelloWorld?wsdl
        127.0.0.1:7301/osb-101-helloworld/HelloWorld?wsdl like this how can i deploy my service ?

        Delete
      3. Hi

        In order to access service check step 19..
        http://[managed server ip address]:[managed server port no]/yourproxyurl?wsdl
        yourproxyurl: can be found out from proxy configuration page

        like : http://127.0.0.1:7201/yourproxyurl?wsdl

        You have to just create a proxy service in SB console (i.e running at 7001 ) by default the same service would be available to other managed server running at 7201 & 7301
        You don't need to deploy on the managed servers.

        Delete
    7. If i do this physical servers
      1. 192.168.x.1 -- Proxy (Load Balancer)
      2. 192.168.x.2 -- osb1
      3. 192.168.x.3 -- osb2

      is it creating process same way osb1, osb2 without adminserver ?

      ReplyDelete
    8. Hi Abhinav first of all thanks for this handy sharing..

      I want to do this OSB clustering with two physical unix server.. Two managed server will run in two separate Ip's.
      Load balancer will also be there above all the managed servers.
      Can you please provide your valuable inputs for configuring this setup.
      Thanks in advance.

      ReplyDelete
      Replies
      1. Apologies for the late reply ..

        As you have mentioned in your post that two managed server are running on different boxes, check the step #6 above in the post.. under listen address for two managed server provide the ip address and port for the two managed server respectively ....

        And in the Step #7 add those ip's in to the cluster address ..

        In the step #10 Configure your machine .. do select UNIX machine as you mentioned you are using the same ...
        from the upper left tab in the window and fill in the details for the two different unix machines

        clickk on Help at below left side of configuration wizard .. to understand the field description ... as it is quite ambiguous ..

        Nodemanger gives u an edge to control the managed server remotely ...
        And i think you are good to go....

        Thanks ,
        Abhinav



        Delete
      2. Brilliant! Thanks so much. Load balancer was the last thing i needed. Now to try on a SOA Cluster

        Delete
    9. Hi Abhinav, could you share load balancing war or the weblogic application with me please, I'm trying to configure a load balancer using OSB. Thanks!

      ReplyDelete
    10. This comment has been removed by a blog administrator.

      ReplyDelete
    11. This blog gives very important info ,thanks for sharning
      Oracle SOA Online Training Hyderabad

      ReplyDelete
    12. Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support in this area. same as your blog i found another one Oracle OSB Training .Actually I was looking for the same information on internet for Oracle OSB and came across your blog. I am impressed by the information that you have on this blog. Thanks once more for all the details.

      ReplyDelete
    13. I wish to show thanks to you just for bailing me out of this particular trouble. As a result of checking through the net and meeting techniques that were not productive, Same as your blog I found another one Oracle OSB 12c.Actually I was looking for the same information on internet for Oracle OSB 12c and came across your blog. I am impressed by the information that you have on this blog. Thanks once more for all the details.

      ReplyDelete
    14. This comment has been removed by the author.

      ReplyDelete