How to Configure Advanced Load Balancer Settings on VergeCloud: Types and Health Checks

Configuring Advanced Load Balancer Settings on VergeCloud: Balancing Types and Health Checks

Load Balancer Advanced Settings

The "Advanced Settings" feature in VergeCloud CDN allows for precise management of user traffic and load balancing behavior. This feature can be accessed after selecting the domain within the VergeCloud CDN panel under the "Traffic" section and then navigating to "Advanced Settings".

Glossary

  • Load Balancing: The process of distributing network traffic across multiple servers to ensure reliability and performance.
  • Round Robin: A load balancing algorithm that distributes requests in a rotating manner among available servers.
  • Client IP Hash: A method that directs traffic to a specific server based on the user's IP address.
  • Keep-Alive Connection: A feature in HTTP/1.1 that allows the same connection to be used for multiple requests, reducing overhead.

Real Usage Scenarios

For instance, a business operating a web application may experience variable traffic patterns. By employing the Round Robin algorithm, they can evenly distribute incoming requests across three servers, optimizing resource utilization. Conversely, a gaming platform might use the Client IP Hash algorithm to ensure players maintain a stable connection to the same server, enhancing the gaming experience by preserving session data.

Field/Option Descriptions

Load Balancing Type

This section allows you to select the algorithm that determines how requests are distributed among origin servers.

Round Robin Algorithm

The Round Robin algorithm is the most straightforward load balancing technique, distributing user requests in a cyclical manner. For example, if you have six users (u1, u2, u3, u4, u5, u6) and three servers (s1, s2, s3), the requests will be allocated as follows: u1 to s1, u2 to s2, u3 to s3, u4 back to s1, u5 to s2, and u6 to s3. This algorithm is effective when requests are predictable, and server capabilities are similar. If one server possesses greater capacity, you may implement a weighted round robin strategy to leverage its strength.

Client IP Hash Algorithm

This algorithm routes user requests to specific servers based on the hash value of the user's IP address. When a request is received, the Load Balancer computes a hash from the IP address, determining which server will handle the request. This method ensures that requests from the same IP are consistently directed to the same server, maintaining session continuity, which is vital for applications requiring session-specific data.

Advanced Features

Sending User Request to the Next Server in Case of an Error

By enabling this option, if a request encounters errors such as Connection Refused or Connection Error, the request will be automatically routed to the next available server, preventing the primary server's error message from reaching the user. This feature is accessible to Growth plans and above.

Stop Sending Traffic to Faulty Server

Activating this feature will temporarily remove a server from the rotation if it exceeds five error responses, redirecting traffic for 15 seconds. You can modify the error threshold and timeout duration in the settings. This feature is also available in Growth plans and above.

Maintaining Connection with the Origin Server

Enabling this setting keeps the connections to the origin server open for reuse, significantly reducing the number of new connections and the load on the servers. In HTTP/1.0, a new connection is established for each request, but HTTP/1.1 supports Keep-Alive Connections by default, which helps enhance website performance by minimizing latency and conserving CPU resources.

How to Add/Edit/Use the Feature

  1. Select the desired domain in the VergeCloud CDN panel.
  2. Step 1
  3. Navigate to the "Traffic" section and click on "Advanced Settings".
  4. Step 2
  5. Choose the load balancing type from the available options: Round Robin or Client IP Hash.
  6. Step 3
  7. Adjust advanced features such as error handling and connection management as needed.
  8. Step 4

API Example

To configure the advanced load balancing settings in VergeCloud CDN via API, you can utilize the following sample curl request:

curl --location --request PATCH 'https://napi.vergecloud.com/cdn/4.0/domains/yourdomain.com/load-balancers/settings' \
--header 'authority: napi.vergecloud.com' \
--header 'accept: application/json, text/plain, */*' \
--header 'authorization: API KEY' \
--header 'Content-Type: text/plain' \
--data '{"method":"cluster_chash","next_upstream_tcp":"on","protocol":"https","keepalive":"on","max_fails":5,"fail_timeout":"10s"}'

In this request, the method key is critical for determining the load balancing type, with values cluster-rr for Round Robin and cluster-chash for Client IP Hash. The next_upstream_tcp key governs the error handling feature, accepting values on or off. The max_fails and fail_timeout keys manage the "Stop Sending Traffic to Faulty Server" feature, requiring a positive integer and a time duration, respectively. Finally, the keepalive key is for maintaining connections with the origin server, accepting on or off values.

Testing and Validation

To validate the configuration of your advanced settings, you can use tools such as dig, curl, or browser-based checks. Here’s how to test:

  1. Use dig to check DNS propagation and ensure that traffic is directed correctly.
  2. dig yourdomain.com
  3. Employ curl to test connectivity and response from the specified servers.
  4. curl -I https://yourdomain.com
  5. Access your domain through a web browser to confirm that requests are routed to the appropriate server and that performance meets expectations.