hello
yes it is possible to do the load balancing in
orion
i am attching one html file just go through
if.
In case u want more help just reply
me.
bye
sachin
|
This document will show you how to set up HTTP Clustering and Load Distribution using the Orion application server.
Before you start, make sure you have downloaded and installed the following software on at least 2 servers:
You also need a network with operational multicast facilities. If you don't have access to 2 servers but want to test this, you can install 2 Orions on the same box and make sure that they are not using the same ports for the RMI server and for the HTTP server. This article has the following sections:
For at least two reasons you often want your web site to be served by more than one web server:
The act of letting two individual servers work together to perform one task is often referred to as clustering. Clustering is an essential piece to solving the needs for today's large websites.
Originally, HTTP was designed as a stateless protocol. Every request had all the info the server needed to perform a certain task. Doing clustering for a stateless system is trivial and only requires that a request can be handled by more than one server that share the same document hierarchy. In today's world, the picture is not as simple. The need for user sessions with data stored on the server about a specific website user resulted in the invention of the HTTP cookie. A cookie is a way for a web server to store data in the web browser. This cookie is passed back to the server on later requests. This is often used to associate some data on the server (state) with a specific user. A typical example is that of a webshop shopping cart. The user adds the goods he wish to purchase to the cart and the server associates the user's cookie with a certain cart stored on the server. As you might have guessed this means that clustering gets somewhat more complex. It is no longer enough that the document hierarchy is shared between the web servers, but now the state stored on a server will mean that requests sent to different servers will result in different results. Somehow we need to solve that. There are two obvious solutions to the problem:
What we see is that option 1 does not provide maybe the most important reason for clustering, fault tolerance. When a server fails the user will have to start over, which might result in him giving up and leaving the site. For this reason option 2, state replication is often required.
As mentioned in the previous section, state should be replicated to at least one other server. However, it is not necessary to replicate all state to every single server. For this reason we are using cluster islands, where an island means a set of servers that share the same state. In a system with 3 islands with 2 servers each, it means that the state for every server will be backup up to one other server.
Load distribution or load balancing (these terms will be used to mean the same thing in this document) means that some process (front-end) acts as a distributor of requests and send different requests off to different servers, or back-ends. As we discussed in the previous section, this might not be a simple task of just choosing a back-end at random but might involve identifying the user before knowing which backend will be suited to handle the specific request. We will later show how the Orion load balancer behaves to perform this task.
Now we will set up Orion for clustering and load distribution step-by-step.
First, make sure that the Orions you are using in your cluster has the same web-application installed. If you do not want this in two places, you can place the actual web-application on a shared drive that both servers access. When you have done this, start all your Orions and check that the web-applications are working correctly on all of them.
Secondly, we want to make sure that the web-application to be clustered is replicating its state to the cluster. We do this by editing the orion-web.xml deployment descriptor for that web-app (orion/application-deployments/[application-name]/[web-app-name]/orion-web.xml). If you want to add clustering for the whole website (for all web-applications), edit the orion-web.xml of the global web-application (NOTE: it will not be applied to all web-applications previous to Orion 1.3.6). This file is normally located at orion/config/global-web-application.xml. All you need to do with this file is adding the following to the main body of the <orion-web-app> tag: <cluster-config/> And save the file. For complete syntax on the cluster-config tag, look here. The settings you can do it to
Repeat this step for all the Orions in your cluster. Setting this up will mean that the following is replicated:
When using multiple islands you might want to use different multicast IPs, to enable "smart" routing of multicast packets in your network and just send traffic on certain IPs to certain servers.
Cluster islands are discussed in an earlier section. Cluster islands are connected to a certain site rather than to a web-application and to configure a cluster island, edit the web-site.xml file for the website your web-application is deployed on (for example default-web-site.xml if you are clustering the default web-application). Add the following to the <web-site> tag: cluster-island="1" If your cluster has more than one island, you will specify different island values for the servers that belong in different islands. Also, if you do not already specify what host the web-site is serving using the host="host/ip" attribute in the <web-site> tag you need to do that. This is because it is not reliable to get the IP of the local host on all platforms, so the back-end needs to tell the front-end about its IP in some other way.
In the same file, the web-site.xml for your web site, you also specify where the load distributor for this web-site is located. In the main body of the <website> tag, add: <frontend host="balancer-host" port="balancer-port" /> Where balancer-host should be replaced with the hostname of the server which will be running the load distributor and balancer-port with the port that will be used for the same. This host and port will make up the public hostname for the site, so port 80 is a good suggestion.
To start the load balancer, simply run java -jar loadbalancer.jar. This will start the load balancer on port 80 on all IP:s on the server its started on. The load balancer can be configured in a few ways. The settings can either be set in the load-balancer.xml file, or they can be given as arguments to the loadbalancer.jar application. The syntax for the configuration file is available here. The usage for loadbalancer.jar is:
Now start the Orions that acts as back-ends in the normal manner (java -jar orion.jar). Now you should soon see that the back-ends get registered with the load balancer. If they do not, a good thing to check is if you are using some dialup-connection from the server that blocks multicast sockets. To see additional info about the progress of the back-ends you can start them using java -Dhttp.cluster.debug=true -Dcluster.debug=true -jar orion.jar
Now we are done with setting it up and we can test that it works. Access the loadbalancer's host and port with your web-browser and you will hopefully see how the request is sent off to one of the back-end servers. Now, if you request the same page again from the same client you will probably be sent to the same server again (see Step 5 about the behavior of the load balancer), but if you request the same page from different clients you will see that the requests get balanced. To test the state replication you can try accessing /servlet/SessionServlet. Request it one time first. Check which server that becomes the primary server for this session. Shut that server down, or try something ruder like removing the network cable from it or simply get out an axe and destroy its hard-drive (if the latter option is chosen, we will not be accepting any responsibility for any permanent damage this might cause to the hard-drive) and then try to request the /servlet/SessionServlet again. If everything works you will now get to the same session as before and the counter will be updated correctly.
|