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.

19 comments:

Edwin Biemond said...

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

Andrejus Baranovskis said...

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

Andreas Koop said...

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.

Anonymous said...

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

Anonymous said...

Hi,

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

hazri said...

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

Bijoy Raveendran said...

@hazri,

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

akhanof said...

@Hazri,

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

Katpally, Rakesh said...

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

Andrejus Baranovskis said...

Hi,

I have packaged it by myself.

Andrejus

Rakesh Reddy said...

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

Andrejus Baranovskis said...

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

Rakesh Reddy said...

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.

Andrejus Baranovskis said...

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

Andrejus

Mohammed Abdel Aziz said...

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

Andrejus Baranovskis said...

Yes, I know :-)

agusta said...

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'

Sameh Nassar said...

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?

Andrejus Baranovskis said...

What is stack trace for MDS error you are getting?

There can be so many different errors in OFM :)

Andrejus