Exchange Server 2007 Active Directory Site and Connector Selection Algorithms
Published Sep 15 2006 02:00 AM 5,313 Views
Microsoft

# Exchange Server 2007 Active Directory Site and Connector Selection Algorithms

When multiple paths exist to a destination, Exchange Server 2007 Routing uses deterministic algorithms to choose one of the paths. The algorithms are deterministic because one of the paths is always chosen (as long as the contributing factors do not change). This article describes the AD Site and Connector Selection algorithms used by Routing.

If a recipient (such as a user mailbox) is located in the remote AD site (or accessible from the remote AD site such as an Exchange Server 2003 mailbox accessible via the first hop RGC homed in the remote AD site) and multiple paths exist to get to that AD Site, Routing chooses one path deterministically in the below order until a single path is left:

a) Path with the lowest cost from source site to the destination site.

b) The path with the least number of segments (i.e., hops).

c) Alphanumerically lower preceding AD Site name.

The term "cost" here can refer to either AD replication cost or the Exchange cost configured on the AD Site Links. If an AD Site Link has been configured with Exchange cost, it will be used as the cost of the Site Link by Exchange Server 2007 Routing. Otherwise, AD replication cost is used. Exchange cost is provided as a means to override AD replication cost, if it is necessary to alter AD topology for Exchange specific purposes.

Some examples illustrating the site selection algorithm are provided below.

Example 1

In the topology below, there are two least cost paths (of total cost 15) for mail sent from site A to R1 in Site D - {A-B-D} with number of segments 2 and {A-B-C-D} with number of segments 3. {A-B-D} is chosen because it has lesser number of segments.

Example 2

In the topology below, mail to R1 from Site A has two equal least cost paths with same number of segments (2) - {A-B-D} and {A-C-D}. Path {A-B-D} is chosen because B is alphanumerically lower than C.

Example 3

In the topology below, mail to R1 from Site A has two least cost paths of the same number of segments (3) - {A-B-D-E} and {A-C-D-E}. Path {A-B-D-E} is chosen because B is alphanumerically lower than C (the site preceding the destination site E is the same in both cases, so the site names preceding that site (D) are compared.)

Other Notes

Using the site selection algorithm described above, once the destination AD Site has been chosen, Exchange Server 2007 Routing attempts to direct relay to the destination. Direct relay can be short circuited due to some factors that are described below.

Hub sites

Hub sites can short circuit direct relay. If a hub site exists in the least cost path (note: the least cost path is chosen first and then the presence of hub site is checked for to determine if the direct relay is short circuited), the mail will stop at a Hub Transport Server in the hub site before it is relayed to the destination. If there are multiple Hub Sites along the least cost path, the mail will stop at each Hub Site along the path before it is relayed to the destination AD Site. The diagram below shows a least cost path from AD Site A to AD Site E. B and D are Hub Sites. The mail from A to recipient R1 will first stop at B and then again at D before it is delivered to E.

Delayed fan-out

If multiple recipients of a single message share part of or the entire least cost path, a single copy of the message is sent with these recipients until the bifurcation point. When the mail reaches the bifurcation point, the message is bifurcated and a separate copy is sent to each recipient. In the diagram below, the least cost path for R1 is A-B-C-D and least cost path to R2 is A-B-C-E. If mail is sent from Site A to recipients R1 and R2, a single copy of the message containing R1 and R2 is relayed to Site C which is the bifurcation point. In Site C, the message is bifurcated and a copy containing R1 is sent to Site D and a copy containing R2 is sent to Site E.

In the example above, if B happens to be a hub site, then a single copy of the message containing R1 and R2 is sent to B. B will then relay a single copy of the message to C. In Site C, the message is bifurcated to D and E.

Back off

Another factor that can prevent direct relay to the destination is if SMTP connection cannot be established to any of the Hub Transport servers in the destination AD site. In that case, a back off mechanism is employed and mail will be queued at the site closest to the destination site (which could be the source site if all the intermediate sites are down).

Connector Selection Algorithm

If an external recipient can be routed using more than one send connector and these connectors all meet the message size constraints, Exchange Server 2007 Routing chooses one of the connectors deterministically. The selection algorithm varies slightly depending on whether the choice is between multiple Exchange Server 2007 connectors or between Exchange Server 2007 and Exchange Server 2003 connectors.

Note that Exchange Server 2007 routing does not load balance among multiple connectors. Load balancing can be accomplished by adding multiple source servers to a single connector. Instead, it will always choose one of the connectors deterministically following the two core tenets of Exchange Server 2007 Routing - least cost and deterministic routing. Load balancing will be covered in a separate article.

Below is the connector selection algorithm used by Exchange Server 2007 Routing:

a) Connector with the most specific address space match.

b) At this point, if the choice is between two or more Exchange Server 2007 connectors, the following selection method is followed:

1. Cost of the connector (which is the sum of the cost to get to one of the source transport servers of the connector and the cost of the address space; the former is 0 if the source transport servers are in the local AD site).
2. Closer proximity (Local Server is closer than Local AD Site which is closer than Remote AD Site).
3. Alphanumerically lower connector name.

If the choice is between two or more Exchange Server 2003 connectors, the following selection method is followed:

1. Cost of the connector (which is the sum of the cost to get to one of the source transport servers of the connector and the cost of the address space).
2. Alphanumerically lower connector name.

If the choice is between an Exchange Server 2007 and an Exchange Server 2003 connector:

1. Exchange Server 2007 connector is always chosen over Exchange Server 2003 connector.

The cost is overridden when the choice is between Exchange Server 2007 and Exchange Server 2003 connectors because Exchange Server 2003 is not aware of Exchange Server 2007 costs (i.e., the cost of the AD Site links). Preferring Exchange Server 2007 connectors also avoids routing loops. Because Exchange Server 2003 is not aware of Exchange Server 2007  connector costs, it is possible that it views Exchange Server 2007 connector has lower cost than an Exchange Server 2003 connector although the former may have a higher cost. Because of this, Exchange Server 2003 server can route to a higher cost Exchange Server 2007 connector. If Exchange Server 2007 always chose the least cost connector, it would route the mail back to the Exchange Server 2003 connector. This can cause routing loops as mail ping pongs between Exchange Server 2007 and Exchange Server 2003 routing groups. To break the loop, when the choice is between an Exchange Server 2007 and an Exchange Server 2003 connectors, Exchange Server 2007 Routing will always choose the Exchange Server 2007 connec tor regardless of the cost. Keep in mind that Exchange Server 2007 connector is only preferred over Exchange Server 2003 connector when both have the same address space match for a recipient.

Here are some examples illustrating this algorithm.

Example 1

In the topology below, there are two candidate connectors, C1 on the local server and C2 in the remote AD Site C, for emails sent from the local server in AD Site A to user@subdomain1.domain1.com. C2 is the more specific address space match and is chosen.

Example 2

In the topology below, there are two candidate connectors, C1 on the local server and C2 in the remote AD Site C, for emails sent from the local server in AD Site A to user@subdomain1.domain1.com. Both connectors have the same address space match for user@subdomain1.domain1.com and same cost (15). C1 has a closer proximity than C2 and will be chosen.

Example 3

In the topology below, there are two candidate connectors, C1 and C2, for emails sent from AD Site A to user@subdomain1.domain1.com. In this case, since both connectors have the same address space match for user@subdomain1.domain1.com, same cost (5 + 10 = 15), and same proximity (Remote AD Site), connector name acts as the tie breaker and C1 will be chosen.

Example 4

In the topology below, if mail is sent to user1@subdomain1.domain1.com from AD Site A, there are two candidate connectors - C2 homed in AD Site D and C1 homed in Exchange Server 2003 Routing Group 1. Both have the same address space match for user1@subdomain1.domain1.com.

C2 total cost = 15:

Cost to remote AD Site (5) +

C1 total cost = 11:

Cost to remote AD Site (5) +

Cost of RGC 1 (5) +

Although C1 has a lower total cost than C2, C2 is chosen because it is homed on an Exchange Server 2007 server.

Other Notes

Some notes related to connector selection:

1) Exchange Server 2007 supports scoping connectors to an AD Site (similar to Exchange Server 2003 supporting scoping per Routing Group). Scoping the connector affects the visibility of the connector. If a connector is scoped to an AD Site (by prefixing Local: to the address space), then it will not be visible in other AD Sites. It will also not be visible to other routing groups (because Exchange Server 2003 servers see Local: and the fact that the connector is homed in Exchange Server 2007 Routing Group and will ignore it). In such a case, although there may be two connectors configured in the organization, to the connector selection algorithm executed on the Hub Transport Server in an AD Site, it may look like there is a single connector.

2) After choosing one connector deterministically using the algorithm described in this section, if the connector happens to be homed in a remote AD site, it is possible that there may be multiple paths to get to that AD site in order to reach the connector. In that case, AD Site Selection algorithm described in Section 1 comes into play in order to choose one path to the destination AD site deterministically.