Chrony default NTP client
Make chrony the default NTP client.
- Name: Miroslav Lichvar
- Email: firstname.lastname@example.org
- Targeted release: Fedora 16
- Last updated: 2011-07-19
- Percentage of completion: 0%
Chrony is an NTP client and server designed to work well without permanent network connection. It uses different algorithms to discipline the clock which gives chrony several advantages over ntp:
- periodic polling of servers is not required which allows it to work well even with large periods of time without network connection
- much faster synchronization, it usually needs only minutes instead of hours to minimize the time and frequency error
- larger range for frequency correction (100000 ppm vs 500 ppm), this is useful for systems running in virtual machines which may have unstable and quickly drifting clocks
- after the initial synchronization the clock is never stepped, this is good for applications which need system time to be monotonic
- better response to rapid changes in the clock frequency
- better stability with temporary asymmetric delays, e.g. when the link is saturated by a large download
An extensive comparison of ntp and chrony done in a simulator is here. Note that current Linux kernels are compiled with SHIFT_PLL=2.
Using chrony over ntp has also other advantages:
- smaller memory footprint (1.3MB vs 6MB resident size)
- no unnecessary process wakeups, this is good for powersaving. The ntpd process normally wakes up every second. We apply a patch which reduces the number of wakeups significantly, but upstream is not interested in fixing it (ntp bug #802).
There are also some disadvantages:
- ntp may still perform better in some conditions, but the differences are quite small (see the simulations)
- chrony corrects the offset by the adjtime() function which means there are short term frequency errors up to 500 ppm
- advanced NTP features like Autokey authentication are not supported
Benefit to Fedora
Better timekeeping on systems not running 24/7 or without permanent internet connection or with low quality/unstable clocks (virtual machines). Once the clock is synchronized, applications are not upset by backward time jumps.
- system-config-date needs to be patched to support both packages and remove the dependency on ntp. The supported options supported by system-config-date are identical in ntp.conf and chrony.conf, so it's just a matter of finding out which one is installed/enabled and select the correct path and service name. A patch is available (bug #616385).
- gnome-settings-daemon needs to be patched to support enabling and disabling chrony service. A patch is available (bug #723212).
- comps needs to be modified to install chrony by default and mark ntp as an optional package
How To Test
- make fresh installation, or install chrony and uninstall ntp
- start NTP in system-config-date and let it run for few minutes
- check "chronyc tracking" output. The Reference ID field should be a valid NTP server (not 0.0.0.0), System time should be close to zero (less than few milliseconds).
- make sure it works also after reboot, suspend and reconnecting to a network.
system-config-date gnome-settings-daemon comps
Switching the optional/default types for the ntp and chrony packages in the comps will revert to installing ntp by default. system-config-date can still support both packages and doesn't need to depend on any of the two packages.
- Fedora now installs chrony as the default NTP client. The ntp package is still supported. The users are encouraged to install ntp and uninstall chrony if it suits their needs better.