Select source with minimum distance using a scoring system

Each source has a score against currently selected source which is
updated (multiplied by ratio of their distances) when one of the two
sources has a new sample. When the score reaches a limit, the source
will be selected. This should allow to slowly select the source with
minimum distance without frequent reselecting.

To avoid switching between sources with very variable distances (e.g. on
LAN or when upstream server uses a longer polling interval), sources
that are currently not selected are penalized by a fixed distance. This
can be configured with new reselectdist directive (100 microseconds by
default).
This commit is contained in:
Miroslav Lichvar
2011-01-24 17:09:00 +01:00
parent 222198acf3
commit db510a9558
4 changed files with 121 additions and 27 deletions

View File

@@ -1199,6 +1199,7 @@ directives can occur in any order in the file.
* pidfile directive:: Specify the file where chronyd's pid is written
* port directive:: Set port to use for NTP packets
* refclock directive:: Specify a reference clock
* reselectdist directive:: Set improvement in distance needed to reselect a source
* rtcdevice directive:: Specify name of enhanced RTC device (if not /dev/rtc)
* rtcfile directive:: Specify the file where real-time clock data is stored
* rtconutc directive:: Specify that the real time clock keeps UTC not local time
@@ -2424,6 +2425,22 @@ Prefer this source over sources without prefer option.
Never select this source. This is particularly useful for monitoring.
@end table
@c }}}
@c {{{ reselectdist
@node reselectdist directive
@subsection reselectdist
When @code{chronyd} selects synchronisation source from available sources, it
will prefer the one with minimum synchronisation distance. However, to
avoid frequent reselecting when there are sources with similar distance, a
fixed distance is added to the distance for sources that are currently not
selected. This can be set with the @code{reselectdist} option. By default, the
distance is 100 microseconds.
The syntax is
@example
reselectdist <dist-in-seconds>
@end example
@c }}}
@c {{{ rtcdevice
@node rtcdevice directive