The moose likes Servlets and the fly likes getting the server response time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "getting the server response time" Watch "getting the server response time" New topic

getting the server response time

archana vishwanath
Ranch Hand

Joined: Mar 09, 2004
Posts: 39
I have a situation like this and im a new bee.
1.I have two servers
2.The Client request should go to the first server,if it takes too much of time to respond,The request should be redirected to the other server.
Im confused about how to get the server response time...
Can some body throw some light on this....
Thanx a lot in advance
Dominik Ratajski

Joined: Feb 09, 2004
Posts: 14
i think you're getting into a level of complexity that really may not be required. if you're using two servers you should consider a high availability hardware switch to handle the load.
consider the implications that utilising a "redirection swtich" would have on session objects (ie server1 responds initially to the client, then the client gets redirected to server2 for the next response).
to obtain the server response time you'd need to have a seperate threaded servlet running as the controller to constantly poll and measure the other two server response times. this controller would then *forward* requests to whichever server is the quickest.
keep in mind that you now need three servers (one as the controller to the other two) and also that if your controller server or servlet goes down, your application is toast.
from a browser you cannot redirect to the best server without an intemediary (controller) unless you run an applet in the browser. the applet would then send of a request to both servers, and which ever responds first, the applet would then initiate communication with.
archana vishwanath
Ranch Hand

Joined: Mar 09, 2004
Posts: 39
Thanx Dominic,
It was really helpful.May be i should explain the scenario a little better.
This project is for an academic institution for a prticular department activities.They have a server inside there campus which can also be acessed by the outside world.This server is often hacked by the students over there.
Now we have an external server,and the task in front is
1.Local server is the first priority.
2.Only in case the local server is not able to respond properly,The request
has to be redirect to the outside server.
3.The solution should be very cost effective,like no third server and no hardware switch.
Also pls give some clues to get the respose times...
I agree. Here's the link:
subject: getting the server response time
It's not a secret anymore!