To implement a reliable and scalable infrastructure, we must provide redundancy. This means redundancy in:
- Hardware: We must deploy our application across multiple physical hosts, each (ideally) at different geographical locations. This is so that if one data center is offline or destroyed, services deployed at the other data centers can keep our application running.
- Software: We must also deploy multiple instances of our services; this is so that the load of handling requests can be distributed across them. Consequently, this yields the following benefits:
- We can route users to the server which provides them with the quickest response time (usually the one closest geographically to the user)
- We can put one service offline, update it, and bring it back online without affecting the uptime of the entire application
Deploying applications on a cluster allows you to have hardware redundancy, and load balancers provide software redundancy.
A cluster consists of a network of hosts/servers (called nodes). Once these nodes are provisioned, you can then deploy instances of your services inside them. Next, you'll need to configure a load balancer that sits in front of the services and distribute requests to the node with the most available service.
By deploying redundant services on a cluster, it ensures:
- High Availability: If a server becomes unavailable, either through failure or planned maintenance, then the load balancer can implement a failover mechanism and redistribute requests to the healthy instances.
- High Reliability: Redundant instances remove the single point of failure. It means our whole system becomes fault-tolerant.
- High Throughput: By having multiple instances of the service across geographical regions, it allows for low latency.
This may be implemented as a Redundant Array Of Inexpensive Servers (RAIS), the server equivalent of RAID, or Redundant Arrays Of Inexpensive Disks. Whenever a server fails, the service will still be available by serving them from the healthy servers.
However, if you are using a cloud provider like DigitalOcean, they would take care of the hardware redundancy for you. All that's left for us to do is deploy our cluster and configure our load balancer.