[chrony-users] interpolation of offsets in chrony - a robust approach |

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-users Archives ]

*To*: <chrony-users@xxxxxxxxxxxxxxxxxxxx>*Subject*: [chrony-users] interpolation of offsets in chrony - a robust approach*From*: "Charlie Laub" <charleslaub@xxxxxxxxxxxxx>*Date*: Wed, 17 Feb 2021 12:02:12 -0500*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sbcglobal.net; s=s2048; t=1613581355; bh=yMma8cjKCaQb0OW1Aq21Aht1M6ss2HDvOehnIChzZQ8=; h=Reply-To:From:To:Subject:Date:References:From:Subject:Reply-To; b=A7VG0LipixVpe+XupWzAI8OpwAaF/v2Hr3LsMlVr8VcxoGSkAMKW3rH3YeEUrFwQp3tH8qbxdOsR5zGsQOdjDJYeRnkaBBQ8jiIWoAQyOtVg4ZB/ZO0F49tJr0JTauqbWEkr8K/RHu41YE3d7ZRhao2pdLjZrp0ADBbKLkhzMo5GSQrJz1E2RlkKGy/D0giYQUDAULRh/RFzH3t7zHp92Mwj3q35n2B6ZY3o5axqDgdl4Zcs92OIeTy6eM33POwuLHg2cyRZsWR8+/B9IFEE/pcl6+KaEo1IQK0/wlE2D5Dfzj8fwwQUq7tJSMlKDpVnsu3oEqo40XWNbaQLo940VQ==*Thread-index*: AdcFTVLrATVNwjtOQ4K5mhF7kuynGA==

While I was reading the docs I came across these parameters: maxsamples [samples] The maxsamples directive sets the default maximum number of samples that chronyd should keep for each source. This setting can be overridden for individual sources in the server and refclock directives. The default value is 0, which disables the configurable limit. The useful range is 4 to 64. As a special case, setting maxsamples to 1 disables frequency tracking in order to make the sources immediately selectable with only one sample. This can be useful when chronyd is started with the -q or -Q option. minsamples [samples] The minsamples directive sets the default minimum number of samples that chronyd should keep for each source. This setting can be overridden for individual sources in the server and refclock directives. The default value is 6. The useful range is 4 to 64. Forcing chronyd to keep more samples than it would normally keep reduces noise in the estimated frequency and offset, but slows down the response to changes in the frequency and offset of the clock. The offsets in the tracking and sourcestats reports (and the tracking.log and statistics.log files) may be smaller than the actual offsets. Maybe I am way off here, but the descriptions suggest that these retained samples are interpolated using a linear or other form, and then the interpolated info is used by chrony. Is that correct? The offset data is obviously noisy. In addition I have observed on my own machines that there can be occasional outliers that are on the order of 10x larger than usual. So the data also has outliers. A linear regression is not the best way to process this kind of data. Instead a robust analysis method is best. There is a simple and effective one for obtaining the “best fit” slope of a dataset called a Thiel-Sen estimator. There is a great Wikipedia entry for it if you are not familiar with the technique (not sure if links are allowed so I did not include it). In a nutshell, the slope for all pairs of points in the dataset is computed and the median value is selected as the estimate of the slope. It is straightforward to use this to obtain an good estimate of the true offset for any time within the time interval of the dataset, and to make a prediction into the future. Because it can reject outliers and fits noisy data well, it seems like it would be a perfect candidate for a more robust offset estimator in chrony. Normally this is termed an order N^2 difficult problem, because the slope must be calculated for all pairs in the dataset. But to implement this in chrony it seems to me you only need to compute N pairs as each new offset is obtained. This is because the previous pairwise slope values will not change, and it is only the pairwise slope between the single new offset value and the existing, retained values that needs to be calculated. So the overhead would not be large, especially since the number of data points is less than e.g. 64. Would it be worth looking into implementing this estimation method in chrony for predicting the current and future offsets? -Charlie |

**Follow-Ups**:**Re: [chrony-users] interpolation of offsets in chrony - a robust approach***From:*Bill Unruh

**Re: [chrony-users] interpolation of offsets in chrony - a robust approach***From:*Miroslav Lichvar

**Messages sorted by:**[ date | thread ]- Prev by Date:
**RE: [chrony-users] chrony not observing maxpoll - bug?** - Next by Date:
**Re: [chrony-users] interpolation of offsets in chrony - a robust approach** - Previous by thread:
**Re: [chrony-users] Chrony 4.0 in Red Hat Linux 8** - Next by thread:
**Re: [chrony-users] interpolation of offsets in chrony - a robust approach**

Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |