Using VergeCloud CDN, you can efficiently distribute traffic across multiple servers with similar resources and data capabilities. This setup enhances redundancy and reliability by enabling more servers to handle requests effectively.
The advanced features of VergeCloud's load balancing, including geographic traffic steering and Active Health Check, optimize website performance and enhance the end-user experience by directing traffic only to healthy and responsive server pools related to specific countries.
Consider a global e-commerce website that experiences fluctuating traffic. By using VergeCloud’s load balancing, the site can direct users to the closest server pool, ensuring faster response times and maintaining uptime even if one server encounters issues. For example, during a holiday sale, traffic can be distributed evenly among several regional servers, improving both performance and customer satisfaction.
To utilize the load balancing feature, follow these steps:
Combine multiple servers to form a pool of primary servers. The configuration allows specific geographic locations to direct traffic to designated pools. To initiate a new load balancer, navigate to the CDN menu in your account, select the Load Balancing section, and click on Create.
In the new window, you can set the name, descriptions, and method of load balancing.
After establishing a new load balancer, create a pool of main servers by entering their addresses and clicking on Create Pool.
Specify the name, description, distribution method, and server status in the new window.
The available load balancing methods include:
The Origin Server Health Check feature automatically redirects requests if a connection error occurs, ensuring users do not encounter server errors.
Assign geolocations to each pool so that they receive requests from users in those regions. If no specific pool is designated for a location, the traffic defaults to the primary pool.
In the final step, you can check the pools' status and edit monitoring rules by selecting Edit Monitoring. With VergeCloud’s Active Health Check feature, you can automatically evaluate the health of the origin servers in real-time. If any server experiences issues, actions can be taken immediately.
The Active Health Check sends email notifications and can remove an unhealthy server from the load distribution service until it is restored. You can configure monitoring settings based on various criteria, including protocols, paths, methods, response codes, and geolocations.
The monitoring outcome determines the status of each pool:
When monitoring is disabled, no requests are sent from VergeCloud's CDN edge servers to assess server health. In Non-Critical mode, server health is checked, and any issues are communicated via email. In Critical mode, after notifying via email, the problematic server is removed from the load distribution list until the issue is resolved.
It’s essential to configure whitelisting of VergeCloud's edge server IPs in your firewall for effective monitoring.
Follow the steps outlined above to configure load balancing through the VergeCloud dashboard.
Here’s an example of a cURL request to create a new load balancer:
curl -X POST "https://api.vergecloud.com/load-balancing" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "New Load Balancer",
"description": "Load balancer for my e-commerce site",
"method": "active-active",
"pools": [
{
"name": "Pool 1",
"servers": [
{"ip": "192.0.2.1", "port": 80, "weight": 1},
{"ip": "192.0.2.2", "port": 80, "weight": 2}
]
}
]
}'
To test and validate your load balancing configuration, use tools like curl
and dig
to ensure the routing and health checks function as expected. For instance, execute a dig
command to check DNS resolution for your load balancer:
dig +short loadbalancer.yourdomain.com
Additionally, utilize curl
to test the health of the origin servers:
curl -I http://origin-server.yourdomain.com