What is Load Balancing? Guide to Optimizing Website Traffic with VergeCloud

Understanding Load Balancing on VergeCloud: Optimize Traffic Distribution and Performance

Load Balancing

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.

Glossary

  • Pool: A collection of hosting servers identified by their IPs or hostnames, functioning similarly to DNS records.
  • Monitoring: The process of checking the status of servers at regular intervals to ensure their health.
  • Traffic Routing: The method by which the load balancer distributes incoming traffic based on server and pool health.
  • Active Health Check: A feature that assesses server health in real-time, automatically redirecting traffic if issues arise.
  • Geo-steering: A mechanism directing traffic to the nearest server pool based on the user's location.

Real Usage Scenarios

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.

Field/Option Descriptions

Load Balancing Configuration

To utilize the load balancing feature, follow these steps:

1st Step: Load Balancing Management

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.

Load Balancing Management

In the new window, you can set the name, descriptions, and method of load balancing.

Load Balancer Settings
  • Active-Active Method: Randomly distributes traffic among all healthy pools based on their geolocation.
  • Active-Passive Method: Redirects traffic to the first healthy pool unless deemed unhealthy, then to the next available pool.

2nd Step: Pool Management

After establishing a new load balancer, create a pool of main servers by entering their addresses and clicking on Create Pool.

Create Pool Management

Specify the name, description, distribution method, and server status in the new window.

Pool Configuration

The available load balancing methods include:

  • Round-Robin: Distributes requests based on server weight.
  • Client IP Hash: Sends requests to the same server based on the user's IP address.

The Origin Server Health Check feature automatically redirects requests if a connection error occurs, ensuring users do not encounter server errors.

3rd Step: Traffic Routing

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.

Traffic Routing Management

4th Step: Monitoring

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.

Monitoring Configuration

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:

  • Healthy: All servers are responsive and meet monitoring conditions.
  • Warning: The number of servers with errors is below the error threshold.
  • Unhealthy: The number of servers with errors meets or exceeds the error threshold.

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.

How to Add/Edit/Use the Feature

Follow the steps outlined above to configure load balancing through the VergeCloud dashboard.

API Example

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}
            ]
        }
    ]
}'

Testing and Validation

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