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."
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.
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. ??