Tuesday, June 26, 2007
Is probing login.jsp from loadbalancer good option???
Loadbalancing is good for applications for failover conditions. Loadbalancers needs to know the status of the server for redirecting the clients. Many a times people thinks of pointing to login page for load balancer. This seems to be simple but think about the complication of a login page before pointing from load balancer.
Before describing the responsibilities of login page i would like to give an example of load balanced application.
There are two servers behind the load balancer and if a user is logged into one server(Server 1) and directly goes to another server (Server 2). Server 2 should not redirect the user to login page again as backend is same for both the servers.
Now lets see what login page responsibilites are
1) Check if the user is authenticated or not.
2) If the user is authenticated then redirect the user to requested page.
3) Check what access control user has to access the application.
4) Cache the user access rights if user is authenticated.
These are some of the examples and for performing every operation Login page has to call lots of vendor specific API's which are costly and some times they have memory leaks.
Think about a scenario when load balancer is configured to probe each server every 5-10 seconds.
Think again ????
I hope you might have already guessed that Login page is not the right approach at all.
Then what is the solution???
It's always better to build a very light weight application or simple page which is hosted on the server which tells if the server is up or not.
But this will just tell if the server is up or not, what about the repository server which server contacts???
You question is absolutely correct. But again instead of configuring Login page which is costly as discussed above it's better to build a custom page which just checks if the backend repository is up or not.
Hope this helps to some of my friends reading this article.