Re: [Exim] Opinions sought: hosts_max_try

Top Page
Delete this message
Reply to this message
Author: James P. Roberts
Date:  
To: exim-users
Subject: Re: [Exim] Opinions sought: hosts_max_try
----- Original Message -----
From: "Philip Hazel" <ph10@???>
To: <exim-users@???>
Sent: Thursday, August 29, 2002 6:35 AM
Subject: [Exim] Opinions sought: hosts_max_try

<snip>

First comment... I see at least 4 repeat IP addresses in the AOL list. This is
kind of silly on their part, I think. But it does suggest that any list, of
multiple addresses to try, have duplicates removed as the very first step. It
also suggests that one has to weigh the possiblity of an entire host being
unavailable, against the possibility of individual IP address being unavailable
(e.g. a broken ethernet card... on my mind since I just had to replace one
myself).

When one sees multiple IP's pointing to one host, one cannot assume that if one is
down, they are all down. However, if more than one is down, they probably are all
down, and one should skip to the next host on the list, if there is one.

We can also see that, if one IP address points to two hosts, they must be the same
physical host, and we can take that into account when trying to avoid too many
tries to the same host.

My suggestion for attempt order would thus be:

(a) remove duplicate IP addresses from the complete list.
(b) when a duplicate IP address is found, we know that the host is the same, so
replace all occurances of the 2nd host name with the first host name (for sorting
purposes only!)
(c) sort remaining list by MX level.
(d) within each MX level, sort each host by IP address, with a "staggered sort"
(select one at random, then choose remaining one that is most different, and so
forth), such that you maximize the chances of trying different networks on
sequential tries to that host.
(e) interleave the sorted host lists, within each MX level (if there are multiple
hosts in that level), so that you try all the hosts before repeating a try to any
one host.
(f) if host_max_try is not exhausted after up to 2 tries on each host, skip to
next MX level, if it exists. (The idea being that, if two IP addresses on a host
are down, the entire host is probably down).
(g) if you get to the end of this abbreviated list, and host_max_try is not
exhausted yet, continue with 3rd IP of first host in top MX level, etc.

If I interpret myself correctly, the examples Philip provided might come out:
(note: I arbitrarily chose to start with lowest IP of each host, for the
"staggered sorts.")

AOL:
(we notice mailin-03 = mailin-04, and 01=02 also, due to duplicate IPs)
(Only one MX level = 15)
mailin-03.mx.aol.com.    A  64.12.136.217
mailin-01.mx.aol.com.    A  64.12.136.57
mailin-03.mx.aol.com.    A  205.188.158.25
mailin-02.mx.aol.com.    A  205.188.156.154
mailin-04.mx.aol.com.    A  64.12.136.153
mailin-02.mx.aol.com.    A  64.12.136.89
mailin-04.mx.aol.com.    A  152.163.224.122
mailin-01.mx.aol.com.    A  205.188.156.122
mailin-03.mx.aol.com.    A  64.12.136.249
mailin-02.mx.aol.com.    A  64.12.136.121
mailin-04.mx.aol.com.    A  64.12.137.152 (*)
mailin-01.mx.aol.com.    A  152.163.224.26
mailin-04.mx.aol.com.    A  64.12.137.121 (*)
mailin-01.mx.aol.com.    A  64.12.137.89 (*)
mailin-01.mx.aol.com.    A  64.12.137.184 (*)
(*) = indicates a duplicate IP address in the DNS list


Yahoo:
(start at MX level 1)
mx2.mail.yahoo.com.      A  64.157.4.82
mx1.mail.yahoo.com.      A  64.157.4.81
mx2.mail.yahoo.com.      A  64.157.4.88
mx1.mail.yahoo.com.      A  64.157.4.89
(tried each host twice, so try next MX level)
mx4.mail.yahoo.com.      A  216.136.129.11
mx4.mail.yahoo.com.      A  216.136.129.14
(tried host twice, and no next MX level, so return to MX level 1)
mx1.mail.yahoo.com.      A  64.157.4.85
(MX level 1 exhausted, next MX level)
mx4.mail.yahoo.com.      A  216.136.129.16
mx4.mail.yahoo.com.      A  216.136.129.17
(host tried twice, but no more MX levels, so continue)
mx4.mail.yahoo.com.      A  216.136.129.4


I believe that, although this sort algorithm might seem complex, it really isn't
that hard to code.

OK, that's my 2p worth.

Jim Roberts
Punster Productions, Inc.