Clustering: How much does it differ from Load Balancing?
Tags: clustering, architecture, distributedsystems, beginners
Published: 2023-01-22 09:33:58

A cluster can be defined as a group of stuff. Likewise, a computer cluster is a group of computers that works for a common goal. The functionality of clustering is to divide workloads among the computers that act like nodes so that their combined memory and processing power of them all together gives a better overall performance.

All the nodes in a cluster are connected to a network where they form an internode connection and later form a cluster. They even might have shared storage or local storage on each node.

On a cluster, there is always one node that acts as a leader and is an entry point for the cluster. It delegates the tasks to the other fellow nodes and sometimes even returns the result to the user. The whole cluster works like a single system and there is no way for the user to know if they are interacting with a cluster or an individual machine. The clusters lead to low latency and prevent bottlenecks in node-to-node communication as well.

![Clustering](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jnm6gjrbx1mxt8vg19j7.jpg)

We can see clustering in many technologies these days. There are Kubernetes and Amazon ECS as containers, Cassandra and MongoDB as databases, and Redis as caches. There are three types of usual clusters,

- Highly Available or fail-over
- Load Balancing
- High-Performance computing

For the highly available clusters, there are two kinds of configurations. Let’s look at them individually.

## Active-Active Configurations

In the active-active configurations, there are at least two nodes that work together for the same kind of service. The concept of active-active comes from [load balancing](https://dev.to/pragyasapkota/load-balancing-why-do-we-need-them-1kfn) that distributes the work across the devices in the group. This helps the nodes remain intact since the overload is prevented in the configuration.

![Active-Active](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yybg8gvzpfpaxpem4hrk.jpg)

In addition, some nodes are spared to be used later which can help improve throughput and response time.

## Active-Passive Configurations

Further, there is an active-passive configuration where there are at least two nodes like the active-active configurations. However, the node from the active-passive cluster has a special feature. Not all nodes are active in the configuration, but some will be in passive or standby mode as well. They only come forward when the active node fails or goes passive due to any reason.

![Active-Passive](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/de1uk3orfx7c0whektc1.jpg)

## How much different is Clustering from Load Balancing?

While [load balancing](https://dev.to/pragyasapkota/load-balancing-why-do-we-need-them-1kfn) and clustering might sound the same, they are not. They do share some common features though. While the nodes or the servers have no idea of each other’s existence in the load balancer, they are aware of the nodes in clustering. Clustering also gives us redundancy and boosts capacity and availability because all the servers work for the same goal. Likewise, the load balancer makes its node react to the requests they receive respectively.

To note, we can implement both [load balancing](https://dev.to/pragyasapkota/load-balancing-why-do-we-need-them-1kfn) and clustering in the system as well. It can also be in use when independent servers are for the same goal. They can be beneficial when specific web services are required.

## Advantages of Clustering

- Highly Scalable
- Availability
- Improved Performance
- Low Latency
- Cost Effective

## Challenges of Clustering

- More complexity for installation and maintenance
- Increased complications if the nodes are not homogenous
- Managing Storage is hard since the nodes can sometimes over-write one another in shared space
- Extra hard work — distributed data needs to be in sync always

{% embed https://github.com/pragyaasapkota/System-Design-Concepts %}

**_I hope this article was helpful to you._**

**_Please don’t forget to follow me!!!_**

**_Any kind of feedback or comment is welcome!!!_**

**_Thank you for your time and support!!!!_**

**_Keep Reading!! Keep Learning!!!_**