diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-03-02 12:07:14 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-03-02 12:21:12 +0100 |
commit | 2d6c175d9b8b0c8eedda2f9bcf1b96a8117ab441 (patch) | |
tree | 4ed56c90f3d6362faafd33fa30a7ac965d64a4ab | |
parent | 70ee23399cb2c77dec0b6ad3b6030f7cf3105b8f (diff) | |
download | busybox-w32-2d6c175d9b8b0c8eedda2f9bcf1b96a8117ab441.tar.gz busybox-w32-2d6c175d9b8b0c8eedda2f9bcf1b96a8117ab441.tar.bz2 busybox-w32-2d6c175d9b8b0c8eedda2f9bcf1b96a8117ab441.zip |
ntpd: decrease INITIAL_SAMPLES from 4 to 3
This reduces initial traffic to NTP servers when a lot of devices boot at once.
Log inspection tells me we agressively burst-poll servers about 5 times
at startup, even though we usually already update clock after second replies.
INITIAL_SAMPLES can probably be even lower, e.g. 2, but let's be conservative
when changing this stuff.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/ntpd.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/networking/ntpd.c b/networking/ntpd.c index 9c15999f3..caf5cc299 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c | |||
@@ -169,7 +169,7 @@ | |||
169 | * datapoints after the step. | 169 | * datapoints after the step. |
170 | */ | 170 | */ |
171 | 171 | ||
172 | #define INITIAL_SAMPLES 4 /* how many samples do we want for init */ | 172 | #define INITIAL_SAMPLES 3 /* how many samples do we want for init */ |
173 | #define MIN_FREQHOLD 10 /* adjust offset, but not freq in this many first adjustments */ | 173 | #define MIN_FREQHOLD 10 /* adjust offset, but not freq in this many first adjustments */ |
174 | #define BAD_DELAY_GROWTH 4 /* drop packet if its delay grew by more than this factor */ | 174 | #define BAD_DELAY_GROWTH 4 /* drop packet if its delay grew by more than this factor */ |
175 | 175 | ||
@@ -223,7 +223,16 @@ | |||
223 | #define MIN_SELECTED 1 /* minimum intersection survivors */ | 223 | #define MIN_SELECTED 1 /* minimum intersection survivors */ |
224 | #define MIN_CLUSTERED 3 /* minimum cluster survivors */ | 224 | #define MIN_CLUSTERED 3 /* minimum cluster survivors */ |
225 | 225 | ||
226 | #define MAXDRIFT 0.000500 /* frequency drift we can correct (500 PPM) */ | 226 | /* Correct frequency ourself (0) or let kernel do it (1)? */ |
227 | #define USING_KERNEL_PLL_LOOP 1 | ||
228 | // /* frequency drift we can correct (500 PPM) */ | ||
229 | // #define MAXDRIFT 0.000500 | ||
230 | // /* Compromise Allan intercept (sec). doc uses 1500, std ntpd uses 512 */ | ||
231 | // #define ALLAN 512 | ||
232 | // /* PLL loop gain */ | ||
233 | // #define PLL 65536 | ||
234 | // /* FLL loop gain [why it depends on MAXPOLL??] */ | ||
235 | // #define FLL (MAXPOLL + 1) | ||
227 | 236 | ||
228 | /* Poll-adjust threshold. | 237 | /* Poll-adjust threshold. |
229 | * When we see that offset is small enough compared to discipline jitter, | 238 | * When we see that offset is small enough compared to discipline jitter, |
@@ -239,12 +248,6 @@ | |||
239 | */ | 248 | */ |
240 | #define POLLADJ_GATE 4 | 249 | #define POLLADJ_GATE 4 |
241 | #define TIMECONST_HACK_GATE 2 | 250 | #define TIMECONST_HACK_GATE 2 |
242 | /* Compromise Allan intercept (sec). doc uses 1500, std ntpd uses 512 */ | ||
243 | #define ALLAN 512 | ||
244 | /* PLL loop gain */ | ||
245 | #define PLL 65536 | ||
246 | /* FLL loop gain [why it depends on MAXPOLL??] */ | ||
247 | #define FLL (MAXPOLL + 1) | ||
248 | /* Parameter averaging constant */ | 251 | /* Parameter averaging constant */ |
249 | #define AVG 4 | 252 | #define AVG 4 |
250 | 253 | ||
@@ -372,9 +375,6 @@ typedef struct { | |||
372 | char p_hostname[1]; | 375 | char p_hostname[1]; |
373 | } peer_t; | 376 | } peer_t; |
374 | 377 | ||
375 | |||
376 | #define USING_KERNEL_PLL_LOOP 1 | ||
377 | |||
378 | enum { | 378 | enum { |
379 | OPT_n = (1 << 0), | 379 | OPT_n = (1 << 0), |
380 | OPT_q = (1 << 1), | 380 | OPT_q = (1 << 1), |
@@ -453,7 +453,7 @@ struct globals { | |||
453 | */ | 453 | */ |
454 | #define G_precision_exp -9 | 454 | #define G_precision_exp -9 |
455 | /* | 455 | /* |
456 | * G_precision_exp is used only for construction outgoing packets. | 456 | * G_precision_exp is used only for constructing outgoing packets. |
457 | * It's ok to set G_precision_sec to a slightly different value | 457 | * It's ok to set G_precision_sec to a slightly different value |
458 | * (One which is "nicer looking" in logs). | 458 | * (One which is "nicer looking" in logs). |
459 | * Exact value would be (1.0 / (1 << (- G_precision_exp))): | 459 | * Exact value would be (1.0 / (1 << (- G_precision_exp))): |
@@ -484,7 +484,6 @@ struct globals { | |||
484 | }; | 484 | }; |
485 | #define G (*ptr_to_globals) | 485 | #define G (*ptr_to_globals) |
486 | 486 | ||
487 | |||
488 | #define VERB1 if (MAX_VERBOSE && G.verbose) | 487 | #define VERB1 if (MAX_VERBOSE && G.verbose) |
489 | #define VERB2 if (MAX_VERBOSE >= 2 && G.verbose >= 2) | 488 | #define VERB2 if (MAX_VERBOSE >= 2 && G.verbose >= 2) |
490 | #define VERB3 if (MAX_VERBOSE >= 3 && G.verbose >= 3) | 489 | #define VERB3 if (MAX_VERBOSE >= 3 && G.verbose >= 3) |
@@ -989,7 +988,6 @@ send_query_to_peer(peer_t *p) | |||
989 | set_next(p, RESPONSE_INTERVAL); | 988 | set_next(p, RESPONSE_INTERVAL); |
990 | } | 989 | } |
991 | 990 | ||
992 | |||
993 | /* Note that there is no provision to prevent several run_scripts | 991 | /* Note that there is no provision to prevent several run_scripts |
994 | * to be started in quick succession. In fact, it happens rather often | 992 | * to be started in quick succession. In fact, it happens rather often |
995 | * if initial syncronization results in a step. | 993 | * if initial syncronization results in a step. |
@@ -1767,7 +1765,6 @@ update_local_clock(peer_t *p) | |||
1767 | return 1; /* "ok to increase poll interval" */ | 1765 | return 1; /* "ok to increase poll interval" */ |
1768 | } | 1766 | } |
1769 | 1767 | ||
1770 | |||
1771 | /* | 1768 | /* |
1772 | * We've got a new reply packet from a peer, process it | 1769 | * We've got a new reply packet from a peer, process it |
1773 | * (helpers first) | 1770 | * (helpers first) |