System Design Basics: Part 2

In this post we’ll learn about ways of scaling our system and importance of Load Balancer.

You can scale your applications in two ways:

  1. Vertical Scaling
  2. Horizontal Scaling

Pre-read link

Vertical ScalingHorizontal Scaling
1.Vertical scaling is referred as “scale up”, which means the process of adding more resources (CPU/Memory) to your servers.Horizontal scaling is referred as “scale-out”, which means it allows you to scale by adding more servers into your pool of resources.
2.Only suitable for applications with low traffic and is simpler.It is more desirable for large scale applications.
3.Hard limitation on the number of resources that can be configured to a single server.No limitation on resources as multiple servers can be added.
4.No failover and redundancy, application will go down incase server goes down.Multiple instance of the same application is running at a time so incase on of the instance goes down other one will take its place and distribute the load.

Load Balancer

Load balancer is used to distribute incoming traffic among web servers, that are defined in a load-balanced set.
Your service can run in multiple regions, example South Central US, East US, etc. Each instance running in these regions/clusters will will have a unique cname and you directly interact with that instance using this cname. But your client user can’t manage all these cnames to interact with your service. Load-Balancer will manage the traffic to all these cnames internally depending upon the configuration set at GSLB (Global Server Load Balancer) .
The service will have an ingressHost i.e. GSLB endpoint which user/client will interact and internally from this ingressHost cnames will get the request from load balancer.

User connect to the public IP (ingressHost) of the load balancer. Due to load balancer in place, clients can’t reach web servers directly. To enhance the security, private IPs (cnames) are used for communication between servers. Private IP is an IP address that is reachable only between servers with in the same network (intranet). It is unreachable over the internet. The load balancer acts as an intermediate layer that communicates with web servers through private IPs.

Load balancer will take care of failover issues and will be redirecting traffic to the healthy instances of the service. Thus, it has helped in improving the availability of web tier.

How does load balancer act in failover situations?

  • If server 1 goes down, all the traffic will be routed to server 2. This prevents the website from going offline. We will also add a new healthy web server to the server pool to balance the load, once the new server is up load will be distributed again by load balancer.
  • Incase resources are less to handle the traffic load of the website, the load balancer will again come into the picture to scale the infra. All that is needs is to add more servers to the web server pool, and then once the set threshold for resources is met load balancer automatically increase the server and starts to send requests to them.

Leave a Comment

Your email address will not be published. Required fields are marked *