As the name suggests, the DBMIRROR_SEND wait type is related to database mirroring. The database mirroring feature was introduced in SQL Server 2005. However, the feature was deprecated in SQL Server 2012. Let’s look in-depth at the DBMIRROR_SEND wait type.
What is DBMIRROR_SEND Wait in SQL Server?
The DBMIRROR_SEND
wait type is a wait related to synchronous mirroring configuration. The wait
suggests that the task is waiting for a communication backlog at the network
layer for sending messages. It means that the communication layer is starting
to become overloaded and affect the database mirroring data throughput. In case
the disk subsystem connection runs slow, the subsequent DBMIRROR_SEND wait can
go high.
Additionally,
the DBMIRROR_SEND wait gets recorded in the mirror instance and not on the principal
instance. However, in some cases, the wait type can get recorded in the
principal instance as well as the mirror instance. If you notice a high value of DBMIRROR_SEND
waits, it means the mirror instance is experiencing some latency.
There are two different operating modes in the database mirroring that impact the availability and mirror configuration. One is the synchronous mode, and the other is the asynchronous mode. Synchronous mode provides high safety. Asynchronous mode provides high performance.
Synchronous Commit
- In a synchronous commit mode, when a transaction is received, the principal will write a log to the transaction log. However, it does not commit the transaction.
- The principal will send the log record to the mirror.
- The mirror will harden the log record to disk and send an acknowledgment to the principal.
- Once the principal receives the acknowledgment, a confirmation message will be sent to the client for completing the transaction. Finally, the transaction gets committed in the transaction log on the principal.
Asynchronous
The Asynchronous model is similar to the synchronous model, except for the acknowledgment message received at the principal end. It means that the transactions will be committed on the principal without getting the confirmation from mirror. Though the performance of keeping the model asynchronous is high, there will be data loss. In case of a disaster, there could be a situation the transactions are still not committed to the mirror instance.
sys.dm_os_wait_stats
You can track all the dbmirror_send wait type values in the sys.dm_os_wait stats DMV.
How to lower DBMIRROR_SEND?
The wait
type is mostly seen in the synchronous mirroring configurations. The DBMIRROR_SEND
wait gets reduced if the mode is changed from synchronous to asynchronous. If
you are performing this action, the wait type can be lowered significantly. It
also comes with a cost. Setting the mode to asynchronous can lead to data loss.
The option should be handled carefully in the production environment. It is not
always good to set the mirroring mode to asynchronous. Decide based on the
transaction that is going to run at the principal instance.
Bottomline
The DBMIRROR_SEND wait type is related to database mirroring. It is very common to see this wait when the database mirroring is configured in your instance. The Synchronous mirroring option gives a high wait value. Whereas the asynchronous mode will lower the wait.
0 comments:
Post a Comment