List:General Discussion« Previous MessageNext Message »
From:王科选 Date:October 28 2011 8:03am
Subject:Re: how to understand seconds_behind_master
View as plain text  
On 10/28/2011 3:38 PM, jiangwen jiang wrote:
> Hi, all:
>
> I am confusing with seconds_behind_master, in mysql manual, it says:
> In essence, this field measures the time difference in seconds between the
> slave SQL thread and the slave I/O thread.
>
> how to understand this description:
> 1. seconds_behinds_master = ts in SQL thread - ts in I/O thread, or
>      seconds_behinds_mater = ts in I/O thread - ts in SQL thead
> 2. how to get the timestamp in SQL and I/O thread, when this time will
> update?
>
> Thanks
> W.J
>
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.

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