I have come across many people who have asked me the difference between Load balancing and clustering. Sometime, I have been asked to compare both of them. Depending upon the context, explanation differs.
Following is my effort to present things in bits and pieces so that person can make their own judgment
Clustering: It is the use of multiple computers to provide a single service or Making a group of application providers appear as one application provider.
Load Balancing: It is a technique to use multiple computers in a cluster. Or, it is Shifting of the computational task of an application across various providers based on some predetermine heuristic.
In other word we can say that Cluster is an object(s), Load Balancing is a method.
When you say “Clustering” you usually means something where applications servers share an application as well as runtime state for that application across multiple machines so that if one fails another machine can resume executing the application with all state information in tact. That is in Cluster A [ X Y Z] there is some method where a user connects to Cluster A and during his use if machine X fails, Y and Z can continue the service uninterrupted. This usually means that at any point in time, at least 2 machines contain the state information for any one user. Could be all of them do, but at least 2 do.
When you say “Load Balancing”, you usually are talking about something either less fault tolerant than “Clustering” or stateless past a request. In Group A [X Y Z] I make a request. It is assigned to X process and X returns the result. If the application is stateful, then my session will be bound to X subsequent calls to the application will go to X as well (“Session Affinity”). If the app isn’t stateful, then they will just be re-assigned by the heuristic again. “Load Balancing” in this method tends to be optimized for speed (No replication overhead, so more computational resources are available to the user) but not as fault tolerant as “Clustering” (if the server I am using dies, my session is lost).
If we are talking about a mailing solution, following example make sense.
• Clustering is NOT load balancing.
• Suppose your mail server is running on three (3) servers in cluster mode. These servers will have three different IP. You will have to create three set of user whom you can allocate one fixed IP out of three IPs. In case one server is down, IP will transferred to another machine (let us from server 2 to server 1) and all users of server 2 will shift to server 1. Now the catch 🙂
o Load has not been balanced. Only in case of fail-over, it allows you to migrate to the new machine not in case of overloading.
o Now, if you increase the one more server then to accommodate 4th server, again you have to redistribute the user among 4 servers which is logistically challenging too. We call this HARDCODED BLALANCING
• Clustering doesn’t take care of health check. Clustering is always on HARDWARE level not on software level. Hence unless and until system crashes , request will go that particular ip irrespective application is running or not. In case of decent hardware, system will never fail (which will give notion that application is not down) and services to user will down.
• Generally available as part of an enterprise package for an application server
• Solution doesn’t require a lot of networking skills
• High availability is not assured using clustering solutions
• Best practices dictate the cluster controller be deployed on separate hardware
• Requires node agents on managed application server instances
• Clustering is “proprietary” in that you can only cluster homogeneous servers.
• Can provide high availability and load balancing across heterogeneous environments
• Offers additional value such as optimization, security, and acceleration for applications
• Transparent – doesn’t require changes to applications or the servers on which they are deployed
• Adds another piece of infrastructure to the architecture
• May require a new set of skills to deploy and manage