Clusters

Many machines, one system · Part of Networking and infrastructure

Key idea

Practice

7 questions · about 4 min

Explained step by step

Cluster

A cluster is a group of 2 or more computers, called nodes, connected by a network and working together toward one goal. It's like a moving crew: 4 people carrying boxes finish much sooner than 1. If there are 1,000 tasks that can be done separately, 10 nodes do 100 each, adding up their memory and processors. To whoever uses it, the cluster looks like a single machine.

There are 3 kinds of cluster depending on what they're for. High-availability (or fail-over) ones aim to keep the service from going down: if a node fails, another takes over. Load-balancing ones spread many requests across the nodes. High-performance ones combine the power of many machines for huge calculations, like weather forecasts. It's like 3 different teams: one with substitutes, one that splits customers and one that lifts something very heavy together.

Clusters and load balancing look alike but aren't the same. In a cluster, the nodes know about each other and collaborate on the same job, like orchestra musicians listening to each other. With a load balancer, servers don't know about one another: each serves what reaches it, like supermarket cashiers who don't talk. They can be used together: a load balancer in front of an active-active cluster.

A cluster gives availability, scalability, performance and good cost, but it complicates operations. You have to install and update the system, the app and everything it needs on every node: with 20 nodes, each update is done 20 times. You have to watch each one's usage and gather their logs in one place. And storage is delicate: if they share a disk, 2 nodes can't overwrite each other writing the same thing. It's like coordinating a 20-piece band instead of playing solo.

Leader node

A cluster usually has a leader node, which is the entry point. It takes the work, hands it out to the other nodes and, if needed, gathers the results to return a single answer. It's like a restaurant's head chef: they get table 5's order, ask one cook for the meat and another for the salad, and plate the dish. The customer never talks to the cooks, they only see the finished dish.

Active-active

In an active-active cluster, at least 2 nodes do the same work at the same time, and a load balancer spreads requests between them. It's like a supermarket with 2 open checkouts: both take payments at once. With more nodes serving, throughput (how much is processed per second) goes up and response times go down. And if one checkout breaks, the other keeps going, slower but without closing.

Active-passive

In an active-passive cluster there are at least 2 nodes, but only one works. The other is on standby, like the backup goalkeeper on the bench: they don't play, but if the starter gets hurt, they go in. If the active node fails, the passive one takes its place (that's fail-over). Half the capacity sits unused in normal times, in exchange for keeping things running when something breaks.

Terms in this lesson

Arki, the beaver mascot

Your next interview starts with 5 minutes today.

Free on iOS and Android. Start from zero, no account needed.

Key idea

Many machines, one system