3

I have a group of servers located in several data centers. They should all be synced so that they have the same time, and ideally, should also have the correct time.

Is it better to sync them all with the same servers, irrespective of geography, or is it better to sync them with close servers?

squidpickles
  • 791
  • 1
  • 8
  • 12

2 Answers2

6

My preference would be to configure the clients to use the closer NTP servers for two reasons:

  • Less distance means less risk of network disruption between the clients and the servers. You don't want your clients to become cut off and start drifting.
  • Less distance means less network latency and, more importantly, less variation in network latency.

You can maintain correctness of the local NTP servers either through multiple reference servers or via a time source such as a GPS receiver. Correctness at every site will ensure the same time at every site.

Tom Shaw
  • 3,752
  • 16
  • 23
  • Ah, Tom - have not seen you for a while - welcome back :) – the-wabbit Sep 23 '11 at 13:25
  • Thanks. That was my intuitive guess. Would it make sense to add peer entries for all of my servers, and just vary the server entries based on location? – squidpickles Sep 23 '11 at 19:30
  • Thanks syneticon-dj :) @slugchewer - The peer entries will be at a lower stratum than the server entries, so they will only come into play when the servers are unreachable or marked as bad. I generally use that model in HA clusters where internal consistency of the cluster is very much more important than correctness of time. However, you will still have hiccups when the external correct time source is re-established. Better in general to aim for correctness through redundant time sources. – Tom Shaw Sep 24 '11 at 01:27
  • @slugchewer By the way, you're not from the OPERA Collaboration are you? ;-) – Tom Shaw Sep 24 '11 at 01:30
  • Nope. Nothing like that. – squidpickles Sep 27 '11 at 00:48
1

It does depend a bit on your accuracy requirements and the way your servers are keeping time and interpreting the NTP data. A full NTP implementation aiming to keep accurate time is a surprisingly scientific thing. There are simplified implementations which basically drop most of the internal processing and in-between-timeskew correction and "just sync to the time they are told" - this is called S(implified)NTP.

If you have full-fledged NTP implementations, it mostly would not matter which servers you sync to - as long as you can trust most of them to have accurate time, the algorithms will even out skew and latency issues so the clock deviation will be within the range of a few milliseconds.

If you just have SNTP and want "same time", you are probably best advised by running own NTP server(s) and sync your other datacentre machines with them. Even SNTP implementations should measure the network round-trip-time and take it into consideration before setting the clock, so unless you have vastly varying latencies on your links or really bad clocks in your hardware, things should be within the milliseconds range as well.

the-wabbit
  • 40,737
  • 13
  • 111
  • 174