Difference between Clustering and Load balancing?

Human Being picture Human Being · Feb 26, 2013 · Viewed 50k times · Source

What is the difference between Clustering and Load balancing?

I know it is a simple question.But I asked this question to several people, But no one gave reliable answer.

Also I googled a lot and can't get an exact answer .

Hope our Stack users will give the best answer for me.

Answer

pedromarce picture pedromarce · Feb 26, 2013

From Software journal blog an extract.

Clustering has a formal meaning. A cluster is a group of resources that are trying to achieve a common objective, and are aware of one another. Clustering usually involves setting up the resources (servers usually) to exchange details on a particular channel (port) and keep exchanging their states, so a resource’s state is replicated at other places as well. It usually also includes load balancing, wherein, the request is routed to one of the resources in the cluster as per the load balancing policy.

Load balancing can also happen without clustering when we have multiple independent servers that have same setup, but other than that, are unaware of each other. Then, we can use a load balancer to forward requests to either one server or other, but one server does not use the other server’s resources. Also, one resource does not share its state with other resources. Each load balancer basically does following tasks: Continuously check which servers are up. When a new request is received, send it to one of the servers as per the load balancing policy. When a request is received for a user who already has a session, send the user to the same server (This part is important, as otherwise user would keep going between different servers, but not able to really do any work). This part is not required for serving static pages, in that case, there are no user sessions.