Cloud Raya Load Balancer, Solution to Distribute Load Equally
Load Balancer, a single point entry to distribute load between servers and also can act as a proxy for the backend server behind it. Cloud Raya loadbalancer implements a TCP-level with three policies: round-robin, Least connection, and Source IP.
- Round-robin load balancing: Client request are forwarded to each server in turn
- Least connection load balancing: Client requests are distributed to the backend server with the least number of active connections at the time the client request is received.
- Source IP load balancing: This type of load balancing uses an algorithm that takes the source and destination IP address of the client and server to generate a unique hash key. This key is used to allocate the client to a particular server. As the key can be regenerated if the session is broken, this method of load balancing can ensure that the client is directed to the same server that it was using previously.
Creating a Load Balancer
- Login to your Cloud Raya management portal
- Navigate to Networking > Load Balancer
- Click Add New Load Balancer
- Input the required value displayed by dialog box
- Location : Jakarta
- Load Balancer Name: the name of you load balancer rule
- Algorithm : Choose your desired load balancer algorithm (round-robin, least connection, and Soure IP Hash)
- Public Port : Input your public facing port
- Private Port : Input your private port (the listened port at your instances)
- Public IP for LoadBalancer : Choose Acquire Automatically if you don’t have any Public IP or want to acquire new Public IP, otherwise please choose the available Public IP in your load balancer
- Clik Add Load Balancer, and wait until the provisioning is completed
Assigning Backend Server
- Click configure on the new created Load Balancer
- Click Assign new VM, and choose the specific VMs as the backend servers for the loadbalancer
- The final result should be like the below pictures
- No need to assign IP Public to the VM, because you only need the loadbalancer IP Public in front of your servers.
Testing the Load Balancer
Let’s test the load balancer to see if this works. We are gonna use the round-robin as load balancer algorithm. The expected result is, the traffic will forwarded to one web server and another, everytime request been made.
Here, we test using a curl command from command line. The syntax will be like curl http://<load balancer IP>:8080/ curl http://18.104.22.168:8080/
If you plan deploy multiple VMs as Web workers or another app that required multiple computing machines, best to deploy the loadbalancer to distribute the load balancely.