How can I load balance incoming emails across multiple servers using MX records?
Summary
What email marketers say18Marketer opinions
Marketer from Email Geeks clarifies that DNS does allow multiple A records for the same host, and provides <http://www.google.com|www.google.com> as an example.
Email marketer from cPanel Forum warns that not all mail servers respect multiple MX records equally, and some might always try the first one they resolve. This can lead to uneven load distribution.
Email marketer from ServerFault responds that setting up multiple MX records with the same priority will load balance incoming email, however, some mail servers may only try the first one they resolve. Lower priority records provide redundancy if the primary mail server is unavailable.
Email marketer from EmailSecurityBlog responds that DNS round robin load balancing may not be reliable. Some mail servers may cache the IP address of the first server they connect to, causing unequal distribution. Other methods may be better.
Marketer from Email Geeks suggests that DNS servers and resolvers' behavior influences load balancing, and to contact the provider if there are concerns.
Email marketer from MXToolbox Forum responds that a good approach is to use multiple MX records pointing to load balancers. These load balancers then distribute traffic to the actual mail servers. This allows for better control and monitoring.
Marketer from Email Geeks confirms that using multiple email servers in MX with the same priority is a valid strategy for incoming load balancing.
Marketer from Email Geeks shares a customer experience where ISPs tend to resolve to the same server initially with high probability, varying by ISP (Gmail, Microsoft, European).
Email marketer from WebHostingTalk shares that geo-location load balancing can improve email delivery and performance. By directing email to the nearest server, response times are faster, and reliability is increased.
Email marketer from StackOverflow explains that MX records with different priorities act as failovers. If the server with the highest priority is unavailable, the sending server will attempt delivery to the server with the next highest priority. Using same priority means servers will be chosen randomly.
Email marketer from StackExchange suggests that using DNS for email load balancing has limitations. While it distributes the load, it doesn't actively monitor server health. Using a dedicated load balancer offers more control and monitoring capabilities.
Marketer from Email Geeks states DNS load balancing is basic, unsuitable for carrier-level, but free, readily available, and "good enough" for small organizations.
Marketer from Email Geeks explains the security implications of using multiple A records, stating bad actors can target one, unlike using HAProxy. He also details how Gmail likely uses VIPs and a large server infrastructure.
Marketer from Email Geeks warns about not using Cloudflare's RR hiding when using multiple A records, as each record needs to be resolvable to the actual destination IP.
Email marketer from Reddit shares that using multiple MX records for load balancing is a basic method. It's simple to set up but doesn't provide sophisticated features like health checks or session persistence. It is also not immediate failover.
Marketer from Email Geeks suggests that RFC says round robin, but sender-side caching makes it not consistently predictable.
Marketer from Email Geeks suggests avoiding chance when load balancing and shares concerns around allowing direct access to all three servers. Suggests solutions such as HAProxy.
Marketer from Email Geeks suggests using a single MX record pointing to a host with multiple A records (one for each server) to potentially force better round-robin distribution.
What the experts say2Expert opinions
Expert from Word to the Wise explains how to configure your domains and MX records to automatically reroute mail in a failure. This article focuses on how to make your MX records failover, not for load balancing.
Expert from Spam Resource explains that while MX records can be used for basic load balancing, DNS-based methods have limitations, particularly with caching. Load distribution might not be even, and it doesn't account for server health in real-time. More sophisticated solutions involving dedicated load balancers are usually preferred for robust environments.
What the documentation says5Technical articles
Documentation from Microsoft Learn explains that MX records with the lowest preference number (highest priority) are tried first. If multiple MX records have the same preference number, they are tried in an arbitrary order.
Documentation from Exim Wiki explains that Exim, a Mail Transfer Agent, tries MX records in order of preference. When multiple records have the same preference value, Exim randomizes the list before attempting delivery.
Documentation from RFC Editor explains that when multiple MX records have the same preference value, the SMTP client SHOULD try them in a random order. This helps distribute the load across multiple mail servers.
Documentation from DigitalOcean explains that you can load balance incoming email by specifying multiple MX records with the same priority. This tells sending servers that they can try any of these servers to deliver the email.
Documentation from PowerDNS shares that when mail servers have the same MX priority, the mail servers should try to connect to them in random order, and that they do not implement any specific algorithm.