Friday, May 15, 2020

Change weight of OCI Load Balancer Round Robin policy

8:43 AM Posted by Dilli Raj Maharjan 2 comments

A load balancer is a device that acts as a reverse proxy and distributes network or application traffic across a number of defined backend servers. Load balancers are used to increase capacity (concurrent users) and reliability of applications. The Oracle Cloud Infrastructure Load Balancing service provides automated traffic distribution from one entry point to multiple backend servers reachable from virtual cloud network (VCN). The service offers a load balancer with choice of a public or private IP address, and provisioned bandwidth of 10Mbps, 100Mbps, 400Mbps, 8000Mbps.

OCI load balancer Support three policy:

  1. Round Robin
  2. Least Connections
  3. IP Hash

Round Robin is the default load balancer policy. This policy distributes incoming traffic sequentially to each backend server in a backend set list. After each server has received a connection, the load balancer repeats the list in the same order.

Round Robin is a simple load balancing algorithm. It works best when all the backend servers have similar capacity and the processing load required by each request does not vary significantly.
When processing load or capacity varies among backend servers, we can refine each of these policy types with backend server weighting. Weighting affects the proportion of requests directed to each server. For example, a server weighted '3' receives three times the number of connections as a server weighted '1'. We can assign weights based on criteria of our choosing, such as each server's traffic-handling capacity.

In example below I have 2 backend webservers: web1 and web2 with equal weight 1. Initially the web request is send to web1 and web2 sequentially. Later, I changed weight of backend server web2 from 1 to 3. Once the new weight value in effect the traffic was forwarded to web1 for 1 time and 3 times to web2. Basically considering the Capacity and the processing load we can increase the weight value for any of the backend servers.

Following is the step by step process to increase weight for backend server, web2.

Click on Navigation Menu > Networking > Load balancers

On load balance page select the name of the load balancer and click on it.

Click on Backend Sets link under Resources section at the left of the Load balancer page.

Click on name of backend set on the Backend Sets page.

Click on Backends link on the Resource section at the left of the Backend Sets page.

Now we can view the weight value for the backend servers.
At this moment, both web serves have equal weight 1 so while accessing web via loadbalancer IP address we can see that first request went to web1, second request to web2 and thrid to web1 again. This way Round Robin policy works equally 1 time to both the backend server.

First request served by web1. 

Second request served by web2

Third request served from web1 again.

Changing weight of second backend server web2. Select IP address of the web2 server. Click on Action and Edit Weight.

On Edit Weight dialog box, type desired value. We have set value to 3 to send 3 times more traffic than web1. Once value is set click on Save Changes.

Click on View All Work Requests to view the work requests.

Once new weight value is in effect we can see the newly assigned value for second backend set web2.

Now when we access web via loadbalancer, we can notice first request served by web1, then 3 consequitive request by web2 and once again web1.

First request served by web1.

Second request served by web2

Third by web2

Fourth by web2 again.

And fifth request by web1 again.


  1. Great post. well explained with all clear steps 👍👍👍 .