List:General Discussion« Previous MessageNext Message »
From:Luis Motta Campos Date:October 28 2011 8:17am
Subject:Re: how to understand seconds_behind_master
View as plain text  
On 28 Oct 2011, at 10:03, 王科选 wrote:
> According to <High performance mysql>,
> 
> seconds_behinds_master is inaccurate, so I just skipped how it works...
> If you want to measure slave lag, follow that book's suggestion:
> One good solution is a heartbeat record,which is a timestamp that you update once
> persecond on the master.To calculate the lag,you can simply subtract the heartbeat from
> the current timestamp on the slave.


This assumes updates and inserts happen at the same speed on the master and slave. If your
assumption is not true (e.g., slaves with SSD disks; or with different indexes than the
master; or with locked tables because of long-running-queries), this will be as precise
as seconds-behind-master, no more than a lousy estimate.

Cheers.
--
Luis Motta Campos
is a DBA, Foodie, and Photographer

Thread
how to understand seconds_behind_masterjiangwen jiang28 Oct
  • Re: how to understand seconds_behind_master王科选28 Oct
    • Re: how to understand seconds_behind_masterLuis Motta Campos28 Oct
  • Re: how to understand seconds_behind_masterjiangwen jiang28 Oct