Why load balance inbound emails?
if we have thousands of emails to receive per hour, one single server may get exhausted by queuing and processing all these emails.
by deploying multiple MX servers we can evenly distribute the inbound email load to all of them. MX servers at the front, are responsible for email protection also, the email filtering process is time-consuming.
If there is a heavy load like spam attacks, mail delivery will delay, and email missing can occur, to overcome these situations, we must load balance the inbound flow to the other servers for quick processing and smoother delivery.
Design1, Load balancing with MX Record
Email load balance with DNS round-robin
in the above diagram, we have three MX servers mailx1, mailx2, and mailx3. For DNS round-robin to work, we have to declare all of them with the same MX priority. if MX records have the same priority values, DNS will deliver the server IPs in a round-robin fashion. whenever any sender tries to find our mail server, it will ask our DNS server, and the DNS will answer with all these 3 servers in a round-robin fashion, later we will see this in practice.
Let’s say these servers’ IPs are, 126.96.36.199, 188.8.131.52, and 184.108.40.206. and we want to receive emails for the domain mailserverguru.com. We have to setup the DNS A and MX record’s this way:
mailx1 IN A 220.127.116.11
mailx2 IN A 18.104.22.168
mailx3 IN A 22.214.171.124
@ IN MX 10 mailx1.mailserverguru.com.
@ IN MX 10 mailx2.mailserverguru.com.
@ IN MX 10 mailx3.mailserverguru.com.
To learn More about DNS Round-Robin Please watch This video
To learn DNS Round-Robin Setup on Godaddy DNS Please watch this video
Configure Email Routing
After setting up the DNS Part, we need to configure the Email routing to deliver the inbound emails to the respective mailbox server because all user’s inboxes are in the mailbox server. In the 1st diagram, we received mail for a single domain. all the MX servers routed mail to the backend mailbox server.
Email Routing for multiple domains
in this 2nd diagram, we are receiving mail for multiple domains, now all the MX servers must make a routing decision based on the recipient’s domain name or recipient email address. Here, we can see all incoming servers are delivering emails based on the recipient domain to a different server.
Later I will show you how to configure the email routing on the servers.