Understanding Amazon Route 53 Routing Policies: Failover vs. Multivalue
In the world of web services, ensuring that your application remains accessible and responsive is crucial. Amazon Route 53, a highly available and scalable DNS (Domain Name System) service, offers various routing policies to handle traffic efficiently. Two of these policies, Failover routing and Multivalue answer routing, are often discussed but not always clearly understood. Let’s dive into what sets them apart.
Multivalue Answer Routing: Basic Load Balancing
Imagine you have multiple web servers, and you want to distribute traffic among them evenly. Instead of just sending all traffic to one server, you can use Amazon Route 53 to return multiple IP addresses for your web servers in response to DNS queries. This way, client software can connect to different servers each time, spreading the load and improving performance. Route 53 returns the list of IP addresses in random order, but the clients are free to choose any of the addresses when they communicate with your resources.
Multivalue answer routing is a simple load balancing technique. It distributes traffic evenly among multiple healthy targets, ensuring that no single resource becomes overloaded with 100% of the traffic. However, this approach lacks control over traffic distribution, as it utilizes round-robin selection.
Here is how it works: You define a set of records for your resources, for example 4 targets. As long as these targets are healthy, Route 53 will return the targets’ IP addresses in random order to the clients. If the clients choose the first IP address from the list, approximately 25% of the traffic would go to each target. If one of the targets becomes unhealthy, its IP address will be dropped from the list of healthy targets. Each remaining target would then receive approximately 33.3% of the traffic.
The key aspect here is randomness; you don’t have the option to prioritize one resource over another, nor do you control which healthy target will be selected (as clients are free to choose any IP address from the addresses they receive). This simplicity makes Multivalue answer routing a basic, yet effective form of load balancing. Route 53 will return up to 8 healthy addresses for each query, allowing for a fair amount of distribution and redundancy.
Failover Routing: A Backup Plan for Unforeseen Issues
Failover routing is more straightforward in its approach. It's designed for scenarios where you have a primary resource and a secondary backup. The primary resource handles all incoming traffic as long as it’s healthy. Route53 will only reroute traffic to the secondary resource if the primary becomes unhealthy. This setup is ideal for disaster recovery plans where you have a robust primary system and a backup that kicks in only when needed.
Consider a scenario where a client attempts to access a resource. With failover routing, the client will always be directed to the primary record unless it’s experiencing issues. Only then will the traffic be redirected to the secondary resource. The simplicity of this configuration – just a primary and a secondary – makes failover routing a popular choice for many applications that require a high level of reliability.
Which One Should I Use?
Both Multivalue answer and Failover routing policies have their unique strengths. Multivalue routing is ideal for (very) basic load balancing across several resources, offering simplicity and a degree of redundancy. On the other hand, Failover routing is perfect for those who want a clear primary-secondary setup, ensuring high availability and reliability for critical applications. Depending on your application’s needs and your desired level of control over traffic distribution, you can choose the policy that aligns best with your objectives.
Proper Load Balancing
If you need to internally distribute traffic across dynamically changing set of resources, such as in an auto scaling system, we invite you to investigate AWS Auto Scaling and ELB (Elastic Load Balancer).
ELB is a service that automatically distributes incoming application traffic across multiple targets, such as Amazon EC2 instances, containers, IP addresses, and Lambda functions. It ensures that the user traffic is distributed optimally to keep application performance high and can also handle the varying load of your application traffic in a single Availability Zone or across multiple Availability Zones.
We’ll write more about ELB later on.