OCI Load Balancer — Part-I
What is a Load Balancer?
As goes by the name, it means balancing the load i.e. it is used to manage the load aka traffic from internet to your application/database.
Why do we need Load Balancer?
Now-a-days, service providers are deploying their applications on multiple servers so that there won’t be any delay/latency to end users who are accessing the applications. Load Balancer does this easy by diverting traffic to server which is available to process the request.
How does a Load Balancer work?
Every Load Balancer will have a backend set to which we attach couple of backend servers on which our applications/database are installed/configured. Load Balancer keeps polling these backend servers in a certain interval to determine the backend servers are available. When an incoming request reaches load balancer, it routes it to application on appropriate backend server based on the latest health check/polling result. If all the backend servers are available then request will be routed to an appropriate backend server based on the Algorithm chosen while setting up your Load Balancer.
The algorithms used in OCI Load Balancer are as below:
a) Weighted Round Robin → Where requests are routed in a round robin fashion.
b) IP Hash → Where requests from a specific source are always sent to a specific backend server only.
c) Least Connections → Where requests are routed to backend server with fewest active connections.
NOTE: These algorithms are specific to Normal/Generic Load Balancer which features Layer-7 routing.
Does Load Balancer always route requests based on the chosen algorithm?
Yes, unless until you have configured session persistence while setting up your Load Balancer. Will discuss about Session persistence in a different blog until then you can refer to it from here.
What are the different OCI Load Balancer types?
OCI has two types of Load Balancers:
a) General Load Balancer → Which features layer-7 routing and SSL termination. This allows traffic from HTTPS, HTTP, HTTP/2 and TCP types.
b) Network Load Balancer → Which features layer-4 pass-through load balancing. This allows traffic from UDP, TCP and UDP/TCP types.
Load Balancer Visibility
In OCI, you can create both Public Load Balancer and Private Load Balancers.
What are Public & Private Load Balancers? When do we use them?
Public Load Balancer: A Public Load Balancer is one which has Public IP address (it is created on Public Subnet). It is used in general cases where we front-end it for our applications as shown below.
Private Load Balancer: A Private Load Balancer is one which doesn’t have a Public IP Address. We generally use Private Load Balancer to route traffic between our Application Server & Database server as shown below
Will discuss more about Load Balancer concepts in my next read.