A group works better than individuals. And that is why a cluster of servers reaps more benefits than individual servers. So, how does server clustering work? Look at the clustered servers as a team, not just a group. One server takes up the load (of work) when another server cannot.
Now, the term that describes how servers work in a cluster is called load balancing. And as is obvious from the term, the load of work is distributed (balanced) across servers. In a clustered arrangement, multiple servers act as one unit to accomplish a task.
The software program that balances this load is called, hold your breath, load balancer. This program keeps checking for requests for services that arrive on a website. Once a request is received, it sends it to one of the servers in the group of servers supporting the website. And once the server responds, the load balancer sends it to the client who requested it.
The choice of the server to send the request to is decided by taking into account certain parameters. The load balancer analyzes the load, looks into the availability, and capability of the servers. At times, it simply follows the round robin method to choose a server. Some load balancers choose the server at random.
The load balancer serves as the interface between the client and the server. And in doing so, it provides a layer of security to the server. Now you have an idea of what happens in server clustering.