DNS Load Balancer
The VergeCloud DNS Load Balancer allows you to distribute incoming traffic for your domain or subdomains across multiple servers. This distribution can be configured based on the weight of each server, type of response, or the geographic location of the user, providing enhanced reliability and optimal performance.
What is a DNS Load Balancer?
A DNS Load Balancer is a tool that helps in spreading the incoming requests to your domain across multiple servers. This feature enhances redundancy and ensures that no individual server is overloaded, which improves the overall availability and response time of your website.
Steps to Enable DNS Load Balancer
- Navigate to the VergeCloud user panel and select the domain where you wish to configure load balancing.
- Go to the DNS Records section and create a new A Record.
- In the Name field, specify the hostname (subdomain) for which you want to set up load balancing. Use
@
for the root domain or enter the specific subdomain name if applicable. - Provide the IP addresses of the servers in the Value field. You can enter multiple IPs to distribute the traffic among those servers.
- In the Response Type section, specify whether you want the DNS to respond with a single IP or multiple IP addresses when resolving the domain.
Under Load Balancing Method, select the traffic distribution approach:
- Round-Robin: Traffic is distributed in a sequential, cyclical manner.
- Weighted Distribution: Traffic is distributed based on the weight assigned to each server.
- Weight Configuration: Assign weight values to each server to define how traffic is divided. The ratio between weights is important, not the specific value. For example, weights of
1
and 2
are equivalent to weights of 10
and 20
. - Enable Geographic Load Balancing to distribute traffic based on the user's location. Select the desired country for each IP address.
- Click Save to apply the settings.
Creating a Load Balancer Record Using API
You can also configure a load balancer record via VergeCloud's API. Below is an example request that creates a new A Record with load balancing:
- curl --location --request POST 'https://api.vergecloud.com/domains/example.com/dns-records' \ --header 'Authorization: Bearer APIKEY' \ --header 'Content-Type: application/json;charset=UTF-8' \ --data-raw '{"type":"A","name":"@","cloud":false,"value":[{"country":"","ip":"192.168.1.1","port":null,"weight":"20"},{"country":"SG","ip":"192.168.1.2","port":null,"weight":"10"},{"country":"AU","ip":"192.168.1.3","port":null,"weight":"50"}],"upstream_https":"default","ip_filter_mode":{"count":"single","geo_filter":"country","order":"weighted"},"ttl":120}'
Understanding Key Fields in Load Balancer Configuration
Testing DNS Load Balancer Configuration
After setting up your DNS Load Balancer, it's essential to verify the configuration. Use the dig
command to ensure your DNS records are resolving as expected:
dig A example.com
Sample Test Output
; <<>> DiG 9.16.1-Ubuntu <<>> A example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12345
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;example.com. IN A
;; ANSWER SECTION:
example.com. 120 IN A 192.168.1.1
example.com. 120 IN A 192.168.1.2
example.com. 120 IN A 192.168.1.3
;; Query time: 27 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Sep 26 15:10:12 UTC 2024
;; MSG SIZE rcvd: 100
Considerations for DNS Load Balancer
- Use weighted distribution to accommodate servers with different capacities, ensuring more powerful servers receive more traffic.
- Geographic load balancing helps deliver content from the closest server, reducing latency for end users.
- Allow up to 48 hours for DNS changes, including load balancer configuration, to propagate across the internet.