This document describes how to achieve the lowest DNS resolution latency and ensure the security of your business when integrating VolcanoEngine HTTPDNS via HTTP API. HTTPDNS recommends using the default integration solution. You can also try alternative integration solutions by using an Anycast IP address or a dynamic IP address to call the HTTP API.
tip
We recommend that you use the client SDK. If you are unable to integrate the client SDK due to practical constraints, you can use the HTTP API.
Default integration solution
To obtain the resolution result when it cannot be retrieved through the domain name, use the Local DNS server.
Alternative integration solutions
Solution 1: Call the HTTP API via an Anycast IP address
tip
The Anycast IP address access feature is currently in public beta and is not yet available to the public. You can submit a ticket to contact us and obtain an Anycast IP address. To prepare the following fallback strategies when resolution results cannot be obtained through the Anycast IP address:
- If you still cannot obtain resolution results via the domain name, you need to obtain them via the Local DNS server.
Alternative integration solution 2: call HTTP API via dynamic IP address
You can refer to the following steps to integrate the HTTP API.
Step 1: Obtain the optimal HTTPDNS server IP address
The HTTPDNS server will return the following results.
Step 2: Send a direct connection request to the IP address to resolve the domain name
- First, you need to attempt to send requests one by one to the primary IP addresses in main_domains. Start from the first IP address and end at the last IP address. It is recommended that each IP address be tried twice. You can determine the number of attempts based on actual needs.
- If none of the primary IP addresses in main_domains return a resolution result, try the backup IP addresses in backup_domains. Start from the first backup IP address and end at the last backup IP address.
To obtain the parsing result, refer to the ips parameter in the return value after parsing succeeds.
Downgrade strategy
If none of the IP addresses can correctly return parsing results, you need to prepare the following fallback strategies:
- To obtain the parsing result when it cannot be retrieved through the domain name, use the Local DNS server.
Important notes for integration
Manage cached DNS records
You can also reduce the number of requests sent to the HTTPDNS server by caching DNS records. DNS records will expire. When DNS records expire, you need to call the Resolve one or more domain names API to obtain new DNS records and refresh your cache. The client SDK has already implemented comprehensive DNS record expiration management and cache management. You can refer to How it works. Periodically obtain the latest HTTPDNS server IP address
If you use dynamic IP addresses, it is recommended that you regularly obtain the latest server IP address according to the update_interval_min parameter (in minutes) returned by the Get the optimal HTTPDNS server IP address method.