Thursday, April 29, 2010

How SAM and PAM and AM works in failover

Nice post on technet forum:
First I’d like to explain AM, PAM,SAM.



AM is part of the Microsoft Exchange Replication Service that runs on every Exchange 2010 mailbox server. When it first start, it determines the role to assume based on information it gathers and analyzes.



PAM: When a mailbox server is a member of a DAG and currently hosts the default cluster group for the DAG, the assumed role is PAM. The PAM role holder is responsible for making all decisions affecting database availability in a DAG. Only one AM can operate as the PAM role holder at a time. All other servers in the DAG operate as SAM role holders until conditions change.



SAM: When a mailbox server is a member of a DAG but does not currently host the default cluster group for the DAG, the assumed role is SAM. The server can assume the PAM role only if it becomes the host of the default cluster group.



Then I’d like to explain how AM determine the role it could be.





When the AM first starts, it determines the role to assume based on information it gathers and analyzes.


· If the server is a member of a DAG, AM assumes that the current server role is SAM until it can determine otherwise with further processing.

o AM maintains an internal variable called CurrentPAM that is used to identify the DAG server that currently owns the PAM role. At startup, AM sets this value to Unknown until it is able to determine the current PAM holder.

o AM starts a thread to monitor for a change event notification from Windows Failover Clustering to signify the owner of the cluster group has changed.

§ If the cluster group owner changes to this server, then the cluster group has been moved to this server and PAM role ownership must be determined.

· If the CurrentPAM value is different than this server, the AM takes steps to promote this server as the PAM.

o The AM communicates with other servers in the DAG to make sure none of them report they are the PAM.

o When all checks complete successfully, this server assumes the PAM role and sets CurrentPAM to itself.

§ If the cluster group owner changed but to another server in the DAG, this means this server either was the PAM before the cluster group moved, or the cluster group moved between two other servers in the DAG.

· If the CurrentPAM value is this server, then this server has lost the PAM role since it is taken over by the server that now owns the cluster group.

o Any outstanding AM operations on this server are finished immediately.

· The CurrentPAM value is set to the current owner of the cluster group.

·

Once an AM has been promoted to the PAM role, it starts logic to handle automatic database mounting and automatic server/database failover actions.

No comments: