Getty Images
How latency-based routing works in Amazon Route 53
If you're looking at Amazon Route 53 as a way to reduce latency, here's how the service works.
Amazon Route 53, a cloud-based domain name system, maps human-readable internet domain names to actual IP addresses of web-based resources. These resources include webpages, web-available media and web API endpoints.
In its simplest form, Route 53 delivers basic domain name system, or DNS, routing. Route 53 offers other useful capabilities such as domain registration, health checks and a variety of DNS routing policies. Let's explore the available routing policies and how to reduce latency for AWS workloads through Amazon Route 53.
Route 53 routing policies
After a user creates a hosted zone for the domain and creates records to tell the DNS how to route traffic to the domain, they need to choose a routing policy. A routing policy controls how Route 53 responds to queries.
Route 53 routing policies include the following options:
Simple. Maps a domain name to one or more targets and returns results without performing any additional logic. When more than one target is configured, values return randomly.
Failover. Allows users to configure a primary and a secondary, or failover, target, which, in conjunction with health checks, allows Route 53 to return the value of a verified healthy target.
Geolocation. Returns records based on a mapping configured by developers, specifying a target based on the geographic location the query originated from (e.g., continents or even countries).
Geo-proximity. Returns results based on targets configured using the Route 53 Traffic Flow mechanism, which allows configuration of more advanced routing rules, including targets based on the client's geolocation.
Latency-based. Returns the target with the lowest latency, relative to the location of the end user for each request. Developers configure targets in multiple AWS regions and let Route 53 determine the one that will deliver the lowest latency.
IP-based. Routes requests to targets based on the end user's IP. Developers configure CIDR collections with the IP ranges that will be evaluated in IP-based routing, then select which target applies to each IP range.
Multi-value answer. Allows developers to configure multiple targets for a single record and it lets Route 53 return values randomly. One key difference with Simple routing is that it supports configuring health checks for each target, ensuring that only healthy ones are returned to end users.
Weighted routing. Returns values based on a percentage, or weight, configured by developers in Route 53. This is a useful feature in blue/green deployments, when new features are released and it's desired that traffic is routed in a gradual way to an endpoint with the new functionality, such as 5%, 10% and so on.
Latency-based Route 53 configurations
Configurations are a way to optimize cloud deployments to deliver the fastest available response to end users. Latencies can vary significantly depending on where users are located. This is useful for applications that are accessed from multiple geographic locations. Applications may have strict latency requirements, in which a few additional milliseconds in response times can interfere with user experience.
One essential prerequisite for latency-based policies is to have application endpoints in multiple AWS regions. Route 53 determines which target will deliver the lowest latency to users based on internal algorithms and periodic latency measurements managed by AWS.
Latency-based records can be configured using the AWS SDK, AWS CLI or the Amazon Route 53 console. From the console, developers choose to create a new record or update an existing one in a selected hosted zone, as seen in Figure 1.
Developers can use the form to configure the AWS Region a particular record will be associated with, a custom identifier for the record and an optional health check for the configured target. Health checks increase application reliability by allowing Route 53 to return only records that are regularly evaluated and have passed preconfigured tests.
The higher the number of configured regions, the more options Route 53 will have in order to find the lowest latency. It's useful to start with regions that are geographically apart from each other and that are close to the known geographic locations of most application users. For example, if users are known to mainly access an application from North America and Europe, then configuring records for Virginia and Ireland, or other European regions, would ensure users get a more latency-optimized response from Route 53 based on their location.
Cost
Latency-based routing does result in 50% additional cost with respect to DNS queries. Costs can differ:
- Standard queries feature costs $0.40 per million queries for the first 1 billion queries in one month and $0.20 per million queries above 1 billion.
- Latency-based queries cost $0.60 and $0.30 for the same range of queries.
- DNS queries for an application with 100 requests per second would cost approximately $158 per month for Latency-based, compared to approximately $105 per month for Standard.
If Health Checks are configured, they cost $0.50 per month for the basic features and $1.00 per month, per check for more advanced options. Advanced options include features such as string matching, faster intervals and latency measurements.