File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes For Load Balancing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "For Load Balancing" Watch "For Load Balancing" New topic
Author

For Load Balancing

Arvind Subramanian
Ranch Hand

Joined: Jul 25, 2008
Posts: 84
want to write a load balancing app for our web server. So designed to run the seprate thread to check the status of all our web servers at the regular interval of time. What is the best solution for this. How can we able to run a servlet in the regular interval to check all the server? Our all webserver are running in tomcat.


"Many of lifes failure are people who did not realize how close they were to success when they gave up."
-Thomas Edison
~ar~stutzen~
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61773
    
  67

Servlets are ill-suited for running at regular intervals. A servlet is not an appropriate choice for this usage.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Arvind Subramanian
Ranch Hand

Joined: Jul 25, 2008
Posts: 84
Please guide me in it.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61773
    
  67

I have no experience with load balancing, but it's not something handled by a servlet.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18993
    
    8

I'm not sure what it means to "check the status" of a server... but if one of the possible values for status is "Not Running" then it doesn't make sense to have something running in that server try to check for that, right? You should run something outside the server to do the checking.

And no, that wouldn't be a servlet. A plain old Java application run by a plain old job scheduler would be more like it.

I'm not sure you can get from just knowing whether some servers are running to a proper load-balancing application for those servers -- I certainly wouldn't try writing that myself -- but that's a separate topic. Perhaps you aren't actually as ambitious as what that description sounds like.
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
You can run multiple instances of the Tomcat (may be clustered as well with session replication) and let Apache or any other http server do the load balancing.


My Blog
Arvind Subramanian
Ranch Hand

Joined: Jul 25, 2008
Posts: 84
I dont need the very feature rich load balancer(like session transfer). The load balancing is mainly for avoiding transfer of request to the dead webserver server(tomcat or underlying Postgres ).
What i designe is a seprate tomcat instance will be running on the seperate server, which acts as the loadbalancer. Some kind of process or thread must call all the web server at the regular interval and must update about it status. When the request enters the loadbalancer , based on the status and simple round robin the request will be transered to any one of the webserver.

In all the webserver there will be the seprate application running, which will used by the load balancer to check the tomcat and postgres. The request from the loadbalncer will be made to this application for the status.

The confusion i have is how to built that low priority thread to update the status. ??
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: For Load Balancing