How good is NTP for distributed time synchronization?

How accurate is NTP for server time synchronization?

I am writing a service that requires a set of servers (some of which act as clients, and some of them are servers) are synchronized with second level granularity. I am wondering if NTP is best used, or if something is better?

Should I run an ntp server on one of them, and others use this as a source? Any other recommendations / horrors with NTP?

All servers are Linux.

Update: service levels:

I want one server to be accurate UTC (second level, not microsecond or such), and I would like all other servers to be the same as one server, regardless of whether its exact UTC or (events received by this server from several places at different intervals, I require that all these events be the same โ€œrelativeโ€ ts. No, I canโ€™t have a main event TS server when they enter, because it will require saving the offset (when the event really happened and when it was registered about, which requires a lot of extra work), and this inappropriately complicates matters.

Currently, I configured one server as stratum 2 timeserver, using some GPS source sources as servers in ntp.conf, on other servers I installed this server as the only server in ntp.conf.

I hope this will be enough. Thanks!

+4
source share
3 answers

First of all, you can take a look at the NTP Wikipedia page.

In principle, to begin with (I preach this regularly), indicate what levels of service you want, maybe. Do you need an accurate UTC? To what tolerance? So you really need to know what time it is?

Or do you just want accurate synchronization between systems?

How many cars are we talking about and are they geographically distributed?

Some options:

  • exact time: configure at least one server as stratum 2 and let it refer to at least 3 stratum 1 servers. If you have many servers, do it more than one; obviously you get more reliability without a single point of failure.

  • precise synchronization: configure NTP peers.

  • exact time and geographical distribution: more than one stratum 2 server, as described above, with one "next" to each cluster; they can check stratum 2 to improve voting.

I do not think that there is anything well known than NTP available.

Update Another question relates to the PTP time protocol (IEEE 1588). This is great for accurate synchronization, but relies on multicast.

In addition, you should consider getting a GPS time source.

+1
source

NTP will hold you for a second well enough for most applications.

If you need higher accuracy and all servers are running * nix, I would investigate the implementation of Precision Time Protocol . It includes several parental hours and coordination to find a reliable source on the network. This is the recommended time protocol for timestamping events in the power industry (for example, an accurate timestamp in the log files for relay actions and measurement signals that assist in the 2003 Northeast Blackout study ).

+2
source

Yes, configure one of your servers as your own NTP server and synchronize the rest with this. As I recall, it gives you accuracy, usually in milliseconds.

If any of your servers is down - and I can't remember what constitutes an "exit" - NTP will not fix it. There is a way to automatically fix this, but I canโ€™t remember at the moment.

0
source

Source: https://habr.com/ru/post/1340415/


All Articles