Thursday, April 25, 2013

Load Balancing in Weblogic Server

Server load balancing scales "horizontally" to accomodate higher volume work by distributing (balancing) client requests among several servers. This allows more servers (hosts) to be added to handle additional load.

Even if a single server can handle current load, it is still a good idea to design and test your system for scalability.

Having "fault resilience" means that an alternative server can take over when, inevitably, a server crashes or just needs maintenance work done.

Having your applications on more than one machine allows operations personnel to work on one machine while the other is busy working. This is called ensuring uninterrupted continuous avialability of mission-critical applications.

In a production environment, a load balancer or Web proxy server is used to distribute client connection requests, provide load balancing and failover across the cluster, and provide security by concealing the local area network addresses from external users. A load balancer or Web proxy server allows all applications in the domain to be represented as a single address to external clients, and is required when using in-memory replication for client session information.

[A] Load Balancing with an External Hardware Load Balancer
  • f5 (NASDAQ) Big-IP is the most focused on enterprise data centers.
  • Kemp Technologies' $2,500 Load Balancer 1500 3port product has 100Mbps and 100 TPS SSL. has ISO Layer 7 application content switching. Their $9,000 product has 800Mbps throuput and 1000 TPS SSL.
  • Coyote Point $10,000 "Equalizer Extreme" load balancers run within 1U form factor Dell PowerEdge 1750 servers which have Intel Hyper-Threading technology. 3port product has 100Mbps and 100 TPS SSL. has Layer 7 content switching. Their $9,000 product has 800Mbps throuput and 1000 TPS SSL.
  • XRIO in the UK's Neteyes� Cyclone routers combine multiple connections and VPN tunnels.
  • Radware's routers Prioritize traffic and control bandwidth usage Protect your network from malicious attack signatures, denial of service and intrusions End to end monitoring of applications.
    Apache Web server can be setup so that it intelligently redirects clients to a secondary server by altering the Web server configuration files for themod_rewrite module that load balances client requests to resolve logical host names to physical hosts.
  • Nortel
  • Foundry Networks ServerIron
  • Cisco CSS Series (formerly ArrowPoint)
  • 3Com Superstack 3 Server Load Balancer
  • PolyServe Database Utility enables SQL Server consolidation by virtualization of SQL Server machines.
  • Zeus XTMLB
     Load balance testing requires "IP address spoofing" to an allocated range of IP addresses.
    Scripts conducting load balance tests also need to vary the value of cookies.


[B] Load Balancing with a Web Proxy Server
You can implement a Web proxy server using WebLogic Server with the HttpClusterServlet or by using one     of the following Web servers and associated proxy plug-ins:
  • Netscape Enterprise Server with the Netscape (proxy) plug-in
  • Apache with the Apache Server (proxy) plug-in
  • Microsoft Internet Information Server with the Microsoft IIS (proxy) plug-in


Load Balancing with HttpClusterServlet

  1. If you have not already done so, configure a separate, non-clustered Managed Server to host the HTTP Cluster Servlet.
  2. Create the web.xml deployment descriptor file for the servlet. This file must reside in the \WEB-INF subdirectory of the web application directory. 
    1. Define the name and class for the servlet in the <servlet> element in web.xml. The servlet name is HttpClusterServlet. The servlet class isweblogic.servlet.proxy.HttpClusterServlet.
    2. Identify the clustered server instances to which the proxy servlet will direct requests in the <servlet> element in web.xml, by defining the WebLogicCluster parameter.
    3. Create <servlet-mapping> stanzas to specify the requests that the servlet will proxy to the cluster, using the <url-pattern> element to identify specific file extensions, for example *.jsp, or *.html. Define each pattern in a separate <servlet-mapping> stanza.
    4. You can set the <url-pattern> to "/" to proxy any request that cannot be resolved by WebLogic Server to the remote server instance. If you do so, you must also specifically map the following extensions: *.jsp*.html, and *.html, to proxy files ending with those extensions. 
    5. Define, as appropriate, any additional parameters. 

  3. Create the weblogic.xml deployment descriptor file for the servlet. This file must reside in the \WEB-INF subdirectory of the web application directory.
  4. Assign the proxy servlet as the default web application for the Managed Server on the proxy machine by setting the <context-root> element to a forward slash character (/) in the <weblogic-web-app> stanza. 

  5. In the Administration Console, deploy the servlet to the Managed Server on your proxy server machine. 


Sample web.xml

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd";> 
<web-app>
<servlet>
  <servlet-name>
HttpClusterServlet</servlet-name>
    <servlet-class>
      weblogic.servlet.proxy.HttpClusterServlet
    </servlet-class>
  <init-param>
    <param-name>WebLogicCluster</param-name>
    <param-value>
       
hostname1:7002|hostname2:7003|hostname:7004
    </param-value>
  </init-param>
</servlet>
<servlet-mapping>
  <servlet-name>HttpClusterServlet</servlet-name>
  <url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
  <servlet-name>HttpClusterServlet</servlet-name>
  <url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
  <servlet-name>HttpClusterServlet</servlet-name>
  <url-pattern>*.htm</url-pattern>
</servlet-mapping>
<servlet-mapping>
  <servlet-name>HttpClusterServlet</servlet-name>
  <url-pattern>*.html</url-pattern>
</servlet-mapping>
</web-app>

Sample weblogic.xml


<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic
810-web-jar.dtd">
  <weblogic-web-app>
    <context-root>/</context-root>
  </weblogic-web-app>

Accessing Applications Via the Proxy Server

Ensure that applications clients will access via the proxy server are deployed to your cluster. Address client requests to the listen address and listen port of the proxy server.

To verify the configuration of the HttpClusterServlet:

Set the DebugConfigInfo parameter in web.xml to ON.
Use a Web browser to access the following URL:
http://myServer:port/index.jsp
Where:
myServer is the Managed Server on the proxy machine where HttpClusterServlet runs,
port is the port number on that server that is listening for HTTP requests, and index
.jsp is a file that deployed on cluster and does not exist on the proxy server.
The plug-in gathers configuration information and run-time statistics and returns the information to the browser
Flow Like This -

Http Request --> Weblogic Proxy Server --> Cluster  --> Access App deployed on Cluster


 
Load Balancing with HTTP Server

Configure Oracle HTTP Server infront of Oracle WebLogic Server

Configure HTTP Serer infront of WebLogic Server

1. Install WebLogic Server and define server listening on port XXXX (7001 in this example)
2. Install Oracle HTTP Sever 11g 
3. Modify mod_wl_ohs.conf
$ORACLE_INSTANCE/ config/ <COMPONENT_TYPE>/ <COMPONENT_NAME>/mod_wl_ohs.conf
a) For weblogic single instance
<Location /console>
    SetHandler weblogic-handler
    WebLogicHost MS1
    WeblogicPort 7001
</Location>
* This will forward /console from HTTP server to /console on WebLogic Server MS1:7001
b) For Weblogic instances in cluster
<Location /myServerURL>
    SetHandler weblogic-handler
    WebLogicCluster MS1:7010,MS2:7010
</Location>
* This will forward /myServerURL from HTTP server to /myServerURL on WebLogic Cluster MS1:7010 and MS2:7010
4. Restart HTTP Server
$INSTANCE_HOME/ bin/ opmnctl startall
5. Test that you can access application deployed on Weblogic using Oracle HTTP Server like
http://servername:http_portport/console
( http_port you can see or set in httpd.conf )

No comments: