Closed kantp closed 8 years ago
Using the current time from redis will involve an additional roundtrip to the database. @bitonic hat the idea to avoid that via lua scripting, but apparently using TIME
in scripts is forbidden in redis, because it could lead to issues on a cluster.
I have another idea, that avoids the clock skew problems, and should also lead to simpler, and more robust, code in the heartbeat checker.
Instead of periodically updating a timestamp as its heartbeat, each worker will
The heartbeat check will
On the side of checkHeartbeats
, we will still need a clock, but only for
For both purposes, a clock skew is not dangerous: at worst, we make more heartbeat checks than we had planned.
I'm currently exploring the implementation of this design.
I have made a slight modification to the design above
We're having issues where clock skew adversely affects our heartbeat check.
We should consider using the redis TIME command http://redis.io/commands/time, instead of
getUTCTime
, so that we have one clock that all nodes agree on.