Sunday, April 5, 2009

WebLogic Load Balancing for Oracle ADF Applications

Why I like WebLogic server, is because it works as it should work - as it is described in documentation. I'm enjoying to configure WebLogic environment and with my today post I want to share how to setup Load Balancing for Oracle ADF applications using WebLogic 10.3.

Before configuring Load Balancing, we will need to setup WebLogic cluster. Sample Oracle ADF application will be deployed on WebLogic cluster, Load Balancing domain will distribute user requests between cluster members (WebLogic domains).

1. WebLogic Cluster Setup

You can setup WebLogic cluster on your machine very easily, just use standard installation wizard and choose customized installation be selecting 'Yes' and pressing Next button:


Change port number for Administration Server from default to unique in your environment, I will change it to 7002:


Add three (3) Managed Servers, each with unique port number. Defined servers will implement cluster environment:


Configure cluster by accepting defaults, we will change later Multicast to Unicast:


Simply assign all three defined Managed Servers to configured Cluster:


Configure Machine - I will use one physical machine:


Assign all servers to defined machine:


And finally, provide name for cluster domain and specify domain location:


At this point, WebLogic Cluster is installed and ready to be used. Ensure that Admin Server is running, Open Web Console for Admin Server and change Multicast messaging type to Unicast:


You can start each of three Managed Servers in defined Cluster using startManagedWebLogic managedServerName command from console. In Admin Server Web Console you can access Cluster information tab, all three Managed Servers should be running:


Finally, define JDBC Data Source and deploy it on Cluster:


2. Load Balancing Domain Setup

I will describe how to setup Load Balancing with Proxy Plug-in. As proxy, I will use separate WebLogic domain. This domain can be installed as standard domain, without any customizations:


Specify domain name and location:


I have installed Proxy domain for Load Balancing on default, 7001 port - later I will access Oracle ADF application deployed on Cluster environment through 7001 port:


Before you will start to use WebLogic domain as Proxy Plug-in for Load Balancing, you will need to set up HttpClusterServlet. Consult documentation for additional information - Configuring Proxy Plug-Ins. I have used sample web.xml available in documentation, just changed WebLogicCluster parameter value to:

localhost:7003|localhost:7004|localhost:7005

As you can see, I have specified addresses of three Managed Servers from my Cluster. I have packed web.xml along with weblogic.xml into load-balancer.war and have deployed this war file on WebLogic Load Balancing domain:


Load Balancing setup is done.

3. Load Balancing Test

In this section I will describe how to test defined Load Balancing domain and will show how user requests will be distributed across cluster.

First, in cluster environment, from Admin server I will deploy Oracle ADF application. Application will be deployed on cluster:


When application will be deployed and user will access it using (note: I'm using Load Balancing domain port number):

http://localhost:7001/cluster_test/faces/main

One of Managed Servers from Cluster environment will response, in my case it was second server:


Oracle ADF application is opened:


I have opened second session, by pointing to the same 7001 port and it was handled by third Managed Server:


Third session on 7001 Load Balancing port, was handled by first Managed Server:


When I have opened fourth session, it was handled by second Managed Server - second circle have started, its because Cluster is configured with round-robin algorithm. Second Managed Server have responded to fourth session request:


Spanish Summary:

En este artículo, Andrejus nos muestra como realizar la configuración de balanceo de carga en los servidores BEA WebLogic. De esta manera, las peticiones realizadas por los usuarios de las aplicaciones seran procesadas de manera distribuida por los servidores configurados para soportar el balanceo.

30 comments:

  1. Hi Andrejus,

    Can you explain what the load balancing differences are with the wls plugin for apache or using a load balancing router.

    And what is the purpose of the load balancing, will it redirect the http sessions always to the same wls server and what in case of a wls server failure. Did you replicate the http session across the cluster.

    thanks Edwin

    ReplyDelete
  2. Hi Edwin,

    Actually, it was my plan for next post - to describe how to enable replication with load balancing, will post it soon.

    It will be interesting topic to compare WLS plugin for apache and load balancing router in my next posts.

    Thanks,
    Andrejus

    ReplyDelete
  3. Hello Andrejus,

    I have a similar configuration (mod_wl instead of the HttpProxyServlet). But I have problems to deploy my ADF application which itself uses the adf authentication feature.

    I am getting the following ClassNotFoundException:
    oracle.adf.share.security.authentication.AuthenticationServlet

    The problem does not occur if I deploy the same application only to the AdminServer.

    Any idea?

    Thanks,
    Andreas.

    ReplyDelete
  4. Hi,

    I am using a hardware loadbalancer for routing the request to the instances of my cluster. How to setup the confgiration of the cluster for the session replication between the managed servers of the cluster.

    Regards,
    Waqas

    ReplyDelete
  5. Hi,

    When you will post your article regarding weblogic cluster with hardware load balancer.

    ReplyDelete
  6. Hi Andrejus,

    Thanks for this excellent tutorial.
    From your tutorial, after you have setup the Load Balancing Domain, you access Oracle ADF application deployed on Cluster environment through 7001 port;
    as following URL

    http://localhost:7001/cluster_test/faces/main

    My question is,says I follow your tutorial, what to configure if I wanted to access my application without port no? like

    http://localhost/cluster_test/faces/main

    Thanks
    Regards,
    Hazri

    ReplyDelete
  7. @hazri,

    If you can configure your proxy domain to run at port 80, you should be able to do that.

    ReplyDelete
  8. @Hazri,

    you can Also use an Apache Server to redirect request from port 80 to any port you want.

    ReplyDelete
  9. from where did you get the load-balancer.war file

    ReplyDelete
  10. Hi,

    I have packaged it by myself.

    Andrejus

    ReplyDelete
  11. Hello Andrejus,

    Can you provide some detail on how you packaged this war file. if possible can you send it to me. Also, will this whole process work for any application deployed on to weblogic server or is it specific to Oracle ADF Apps.

    Also, will this process work for any version of weblogic ???

    Thanks

    Rakesh

    ReplyDelete
  12. Hi,

    I just packaged WAR file manually, not a big deal...

    Wow - you are asking about everything, I can;t answer about it. I would be able to answer, if I would perform tests on all versions with all apps :)))

    Andrejus

    ReplyDelete
  13. i was just asking because i have some normal war files and other ear files to deploy and also we are confused whether to go with a physical load balancer or to go with cluster config something similar to the one you described here.

    ReplyDelete
  14. If there is budget for hardware load balancer, I would recommend hardware for sure.

    Andrejus

    ReplyDelete
  15. Hi Andrejus,
    we have a problem in deploying app to clustered weblogic at 2 machines but always give an error @ managed server in machine 2
    error about library
    do you have any idea about what may be missed or to do

    ReplyDelete
  16. hi Andrejus,,
    can you help me to solve my problem?
    when i create multicasy cluster, manage server cannot join into cluster.. error message
    'error setting'

    ReplyDelete
  17. Hi,
    I deploy ADF Apllication with MDS enabled to the cluster.
    When I call the application url using proxy server port Get MDS Error, but if I call the application using any of cluster server port It works fine why?

    ReplyDelete
  18. What is stack trace for MDS error you are getting?

    There can be so many different errors in OFM :)

    Andrejus

    ReplyDelete
  19. Thank you so much for the helpful post and the comments!
    It's certainly very interesting to follow this conversation!

    ReplyDelete
  20. Hi Andrejus,

    Any suggestions on how to go about for 2 machines to be used in a cluster. How to setup loadbalancing then ?

    thnks
    Kamaal

    ReplyDelete
  21. Hi Andrejus,

    Thank you very much for your blog! It helped me to build the environment for testing session persistence. We also using weblogic domain as a Proxy Plug-In for this test.
    I would be also interested in question asked by Edwin: what the load balancing differences are with the wls plugin for apache or using a load balancing router. I couldn’t find your blog where you planned to explain this difference. If you published this information please send me the link.
    Also it would be interesting to know what do you think about Oracle active-passive OHS web-tier clustering? Are you planning to publish any document about load balancing using OHS?
    Thanks a lot.
    Alex

    ReplyDelete
  22. hi Andrejus ,
    Can you explain how to make load balancer for the 2 machines on separate ip ?????

    ReplyDelete
  23. Excelent Article Andrejus!

    I never tested it before in Weblogic, even working sometime with OBIEE and ADF. I will test and see, but you can say if you have some problem with performance, when a lot of user accessing?

    Thanks a lot.

    José Roberto Almaráz, Renan's friend from Brazil!

    ReplyDelete
  24. Hi Andrejus,

    We are using default file based policy store(system-jazn) and using OPSS to change application roles dynamically. Every thing worked fine till we went till we reached production. One we went into production(Which is Clustered environment with two nodes) authorization seems to be working till request goes to node where the roles were assigned/reassigned.One the request goes to other node the changes permission seem to be lost.
    Can you please gives pointers of persisting roles across nodes

    Madhu Krishna

    ReplyDelete
  25. We had similar issue, try to move to DB policy store.

    Andrejus

    ReplyDelete
  26. Hi Andrejus,

    We are implementing ADF security using a custom IdentityAsserter and it works as expected on integrated weblogic server.
    when moving to production ( a clustered env with a server admin and two managed servers) it doesn't work anymore. I can see in the logs that the IdentityAsserter is triggered and even it returns false the user is still able to see the page.
    Any idea about the cause of this behavior?

    Thanks,
    Francesco

    ReplyDelete
  27. Uh, this is usually tricky and requires debugging. Hard to say something useful from my head.

    Andrejus

    ReplyDelete
  28. Yes, you are right : it is very tricky.
    I added some statements in ADF code and
    ADFContext.getCurrent().getSecurityContext().isAuthenticationEnabled() returns false.
    it means that the ADF security s not enabled at weblogic server level, right?
    is there something special we have to do when deploying the ADF app in order to 'force' the adf security to be enabled?

    ReplyDelete
  29. Hi Anrdrejus,

    Old post but very informative. We have implemented a test case like that but with 12.1.3 weblogic and adf. Load balancing works and session replication also works. We see a problem with rendering the jsf page after failover.

    i.e. You request a jsf page and get a response from server2. You shutdown server2 and then press a button on the page (to submit). The response you get from the other server (server1) is not rendered correctly (actually you see nothing). If you press reload on the browser then you have the page from server1 without any problem. Is this normal? Do you need to refresh for the page to render correctly after failover?

    Thank you.

    ReplyDelete