Load Balancing
Using Arvancloud CDN, you can distribute the traffic evenly between several servers with similar resources and data. In this way, more servers can respond to requests facilitating redundancy and reliability.
In the new generation of Arvancloud load balancing, the features of geographic traffic steering and Active Health Check by sending requests to healthy and responsive pools related to countries increase the efficiency of the website and the quality of the end-user experience.
This page helps you activate and configure load balancing.
Basic Concepts
Here we explain the basic concepts of our CDN load balancing.
Pool It is a collection of hosting servers distinguished by their IP or Hostname. If you are familiar with DNS, you can look at the pool as a collection of records. The only difference is that the traffic will be distributed among the healthy addresses. You can set health check rules for each pool and define healthy servers.
Monitoring Each monitoring checks the condition for specific status codes or Response Body at regular adjustable intervals to assess the health of the pool. The load balancer will leave that server out when a pool is deemed unhealthy. The settings allow email notification and server deactivation until the problem is fixed. The conditions can be set according to protocols, sent headers, and geolocations.
Load balancing Each load balancer distributes the traffic among the source pools according to the health of the pool and based on its traffic routing. It is possible to configure this setting as active-active or active-passive. Traffic is distributed equally according to geolocation among all healthy pools in the former. However, in the latter, the distribution will be according to the set priority and among only one healthy pool, and other pools will become the fall-back destination. Only when the first pool fails to respond is the traffic redirected to the next one. In the absence of a healthy pool, the traffic will be sent to the default pool.
Traffic Routing The load balancer distributes the traffic of your website among the pools and servers following these three parameters:
Pool’s health: the routing begins by analyzing the healthy status of the pool.
Traffic routing: the selected policy for traffic distribution among the existing pools
Server routing: the selected policy for traffic distribution among the servers of one pool
Geo-steering directs each country's traffic to the associated pool, and when a pool or server becomes unhealthy, the load-balancer and pools redistribute traffic based on these policies. This feature is very important when you want visitors to access the nearest host server to increase website performance.
Unhealthy Pool or Server The benefit of this generation of load balancing is the forwarding of the traffic to servers capable of responding. The healthy status is checked by monitoring, pools, and health checks. The purpose of each health check is to compare the current status of the resources to the previous one. The following conditions will cause failure:
- The response time is longer than the specified duration in the monitoring setting.
- The server does not return the status code or the response body specified in the monitoring setting.
The status of every pool includes the three states of healthy, warning, and unhealthy. The pool is healthy when all servers are responsive, and monitoring conditions are met. When the number of servers with errors is the same or higher than the error threshold, the pool status will be unhealthy. Finally, the pool will have a warning status when the number of servers with errors is lower than the error threshold.
load balancing Configuration
You need to follow the steps below to begin working with the load balancing feature:
Load Balancing Management
Pool Management
Traffic Routing
Monitoring Management
1st Step: Load Balancing Management
You can put many servers together to create a pool of main servers. Having several pools makes a new load balancing system. You can configure traffic of certain geolocations to be sent to specified pools and the pools' status can be studied by monitoring. To create a new load balancing in the CDN menu of your account, click on Load Balancing section, then on create.
You can see the name, descriptions, and method of load balancing in the new window.
The active-active method distributes the traffic randomly between all healthy pools based on their geolocation. When a pool is deemed unhealthy, the traffic is distributed among other healthy pools.
The active-passive method will redirect the incoming traffic to the first healthy pool unless monitoring deems the pool as unhealthy and redirects the traffic to the next one.
When none of the pools are healthy, the traffic will be sent to the default pool.
2nd Step: Pool Management
Once you have created a new load balancer, you need to create a pool of main servers. You can put the addresses of your main servers together and then click on Create Pool.
Write the name, description, distribution method, and activated/ deactivated server error of your pool in the new window.
The load balancing methods include Round-Robin and Client IP Hash. In the former, the requests are distributed among different servers according to their weight, while in the latter, taking into account the user's IP, his requests are sent to the server connected to in the first request.
Origin Server Health Check feature redirects the request automatically to other servers when requests encounter Connection Error, Confused Connection, etc. The server error will not be shown to the user in this case.
You can add servers to the pools. The IP will determine the server’s address, and you can add the desired port and weight to it. Also, when your website needs specific routing (CNAME setup or private hosts such as s3 and cloud container’s domain), you can choose a host header for each server.
The connecting protocol can be HTTP or HTTPS. Choosing the default will configure the settings to the default configurations in the user panel (changeable in HTTPS settings). Choosing an automatic value means that the connecting protocol for the main server in each request equals the visitor’s connection protocol with the CDN service.
Next, you can configure the pool settings, such as prioritizing certain pools or activating/ deactivating them. When deactivated, the pool does not receive traffic.
The default pool cannot be deactivated.
3rd Step: Traffic Routing
You can select geolocation for each pool to have them receive requests from the users of those locations. When a pool is not assigned for a certain location, the traffic will be sent to the default pool.
4th Step: Monitoring
In the last step, you can check the status of the pools and edit the monitoring rules of each pool by clicking on "Edit Monitoring" on the new page. With the help of the Active Health Check feature in Arvancloud CDN, you can automatically and instantly measure the health of the website's origin servers and their ability to respond to user requests. In this way, when a problem occurs on any origin server located in load balancing clusters, it can be informed and necessary measures can be taken to solve the problem.
This feature detects any changes in their status by real-time monitoring of the main servers located in a cluster and takes pre-defined actions for them. Also, when a problem occurs on the servers, the Active Health Check feature, using different settings, can notify you by sending an email about its occurrence or remove that server from the list of main servers of the load distribution service, and when the server condition improves, used in the load distribution service. You can check the pool status or edit the monitoring conditions of the pools in this step. You can analyze the servers based on protocol, path, method, the request method, port, response, expected status code, sent headers, and values. You can configure the geolocation examination to a certain monitoring level to reduce the response time and enhance the active health check to the highest personalized level.
The monitoring result determines the status of each pool. When the servers with errors in each pool are the same or more than the error threshold, the pool displays an error, and traffic will not be redirected. When the servers with errors are below the threshold, the status will show a warning.
At the off monitoring level, no requests will be sent from Arvancloud's CDN edge servers to measure the health of the main server. In the Non-Critical mode, the health of the origin servers is checked and any problems are notified to you by e-mail, and in the Critical level, after the e-mail notification, the server with issues is removed from the list of load distribution servers, and after fixing the server issue it can return to the list of load balancing servers.
In the Zone section, you can specify a different monitoring level for each desired geographic area. In this way, if a problem is observed in that geographical area after checking the health of the website's origin server by Arvancloud's CDN edge servers, action will be taken according to the specified monitoring level.
Note that HTTP requests will be sent with the following User Agent:
User Agent: "Arvancloud-AHC/0.1"
Also, remember that the source IPs sending the request for monitoring the origin server are the IPs of the edge servers of the ArvanCloudCDN, which you need to whitelist in your server's firewall.