On Thu, 2015-11-12 at 09:56 +0800, Chris McCormick wrote:
The algorithm that SyncJams uses is quite simple:
- All nodes keep their own internal metronome (integer counter).
- All nodes broadcast their metronome counter value every tick.
- If a node ever receives a metronome value that is *higher* and
*earlier* that its own metronome, it immediately jumps to the incoming metronome's phase + value. Higher & earlier is treated as always "more correct".
The effect of this is that all nodes sync to the fastest network ping time that is experienced during a session. So if the network has a general latency of 10ms but some packets sneak through in 3ms then the sync difference will be 3ms. The overall effect is that sync gets tighter over time monte-carlo-asymptotically towards the optimal possible latency given the hardware. It also means there is no master/slave setup and that the metronome that every node is syncing to is the virtual "consensus" metronome that emerges from the network rather than one specific node having the best or most correct clock.
Each node assumes it is not the best node, and thereby the group benefits during consensus.
Cool design! Thanks for sharing the ideas behind it.
Roman