Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I detect clock skew among nodes in Azure roles?

I have a time sensitive operation that needs to be aware of clock skew among other computers, and /or guard against such a thing. How can I detect or guard against clock skew?

In my case I'm writing a compressed datetime stamp to Azure Blob. It would be disasterous if different nodes would intererpret that datetime stamp differently (as it can occur during a leap day, or leap second)


More info

I'm trying to detect clock skew in local node current time.

Each node will be writing time sensitive information to a Blob/Table. If the timestamp is older than X than certain actions will occur. If the time is not synchronized, data may be lost or corrupted.

Possible solution

Perhaps I can have each node write its current date to blob storage (32 bytes) on a regular interval, and then query that on a routine basis.

like image 215
makerofthings7 Avatar asked Nov 03 '22 14:11

makerofthings7


1 Answers

There are a few .NET NTP client APIs that will tell you the skew between a local node time and time on a NTP time server. For example:

  • Rebex (see "Determining the time difference between the local time and a time server")
  • ComponentSpace
  • ActiveSocket Toolkit

You could use an NTP client to store both the local time and skew in your blob. When you read the blob on a different node, you could compute that node's local time and skew and compare it to the blob's stored time and skew.

like image 125
artfulmethod Avatar answered Nov 09 '22 08:11

artfulmethod