views:

1291

answers:

3

I have a Glassfish v2u2 cluster with two instances and I want to to fail-over between them. Every document that I read on this subject says that I should use a load balancer in front of Glassfish, like Apache httpd. In this scenario failover works, but I again have a single point of failure. Is Glassfish able to do that fail-over without a load balancer in front?

A: 

No, you can't do it at the application level.

Your options are:

  • Round-robin DNS - expose both your servers to the internet and let the client do the load-balancing - this is quite attractive as it will definitely enable fail-over.
  • Use a different layer 3 load balancing system - such as "Windows network load balancing" , "Linux Network Load balancing" or the one I wrote called "Fluffy Linux cluster"
  • Use a separate load-balancer that has a failover hot spare

In any of these cases you still need to ensure that your database and session data etc, are available and in sync between the members of your cluster, which in practice is much harder.

MarkR
round robin DNS provides poor mans load balancing, it DOES NOT provide fail over. If one goes down then some users simply cant access the site.
corydoras
Round-robin DNS handles failover rather nicely in most web browsers. Web browsers are pretty clever about how they handle it, and will generally transparently try another host if they find one down.That said, you need to ensure that any failed server really does fail, rather than producing an error page - but some sensible scripting will ensure this - for example, shut the web server down if an internal self test is consistently failing.
MarkR
A: 

Hmm.. JBoss can do failover without a load balancer according to the docs (http://docs.jboss.org/jbossas/jboss4guide/r4/html/cluster.chapt.html) Chapter 16.1.2.1. Client-side interceptor.

As far as I know glassfish the cluster provides in-memory session replication between nodes. If I use Suns Glassfish Enterprise Application Server I can use HADB which promisses 99.999% of availability.

kovica
My undestanding from that page is that Jboss can do failover of its EJB service if the client has a sufficiently clever client library- the client knowswhere the fail-over partner is and retries That won't solve the problem of web server failover though.
MarkR
Yes, but I think that that is done automatically.
kovica
+1  A: 

The we solved this is that we have two IP addresses which both respond to the URL. The DNS provider (DNS Made Easy) will round robin between the two. Setting the timeout low will ensure that if one server fails the other will answer. When one server stops responding, DNS Made Easy will only send the other host as the server to respond to this URL. You will have to trust the DNS provider, but you can buy service with extremely high availability of the DNS lookup

As for high availability, you can have cluster setup which allows for session replication so that the user won't loose more than potentially one request which fails.

tronda