[ntp:questions] Re: ntpd, boot time, and hot plugging
Tom Smith
smith at cag.lkg.hp.com
Sun Feb 6 04:53:32 UTC 2005
Brad Knowles wrote:
> At 10:52 PM -0200 2005-02-04, Alain wrote:
>
>> ntpdate with 5 servers 3 seconds
>> ntpdate with 8 servers 4 seconds
>>
>> It looks like ntpdate does most things in parelel.
>
>
> No, it does them in sequence. Witness:
>
> # /usr/bin/time -p ntpdate -b 10.0.1.240 time.euro.apple.com
> de.pool.ntp.org fr.pool.ntp.org nl.pool.ntp.org uk.pool.ntp.org
> 0.europe.pool.ntp.org 1.europe.pool.ntp.org 2.europe.pool.ntp.org
> europe.pool.ntp.org
> Password:
> Looking for host 10.0.1.240 and service ntp
> host found : 10.0.1.240
> Looking for host time.euro.apple.com and service ntp
> host found : interweb.euro.apple.com
> Looking for host de.pool.ntp.org and service ntp
> host found : ipx10540.ipxserver.de
> Looking for host fr.pool.ntp.org and service ntp
> host found : granny.lievin.net
> Looking for host nl.pool.ntp.org and service ntp
> host found : i157107.upc-i.chello.nl
> Looking for host uk.pool.ntp.org and service ntp
> host found : cheddar.halon.org.uk
> Looking for host 0.europe.pool.ntp.org and service ntp
> host found : time.as-computer.biz
> Looking for host 1.europe.pool.ntp.org and service ntp
> host found : change2linux.com
> Looking for host 2.europe.pool.ntp.org and service ntp
> host found : 62.101.81.203
> Looking for host europe.pool.ntp.org and service ntp
> host found : aszlig.net
> 6 Feb 04:05:36 ntpdate[28684]: sendto(10.0.1.240): Host is down
> 6 Feb 04:05:37 ntpdate[28684]: sendto(10.0.1.240): Host is down
> 6 Feb 04:05:38 ntpdate[28684]: sendto(10.0.1.240): Host is down
> 6 Feb 04:05:39 ntpdate[28684]: sendto(10.0.1.240): Host is down
> 6 Feb 04:05:40 ntpdate[28684]: step time server 193.201.200.139 offset
> -0.013175 sec
> real 14.43
> user 0.01
> sys 0.04
>
> And here's ntpd:
>
> # /usr/bin/time -p ntpd -gq -f /var/run/ntp.drift -p /var/run/ntpd.pid
> ntpd: time slew -0.009592s
> real 16.07
> user 0.01
> sys 0.01
>
>
> It just so happens that, in many cases, you can get those few
> packets out to the servers and back quickly enough that ntpdate will
> finish within a few seconds.
>
> Steve has shown that ntpd will get up and running in about seven
> seconds on his machine, whereas it's a bit slower on mine since some of
> the servers I've selected in my ntp.conf are down/non-responsive. I'm
> also on a slow ADSL line, I'm connected to that through an Apple Airport
> Extreme base station on a wireless 802.11b network with WEP encryption
> (which always slows down wireless network throughput), and I'm running
> on an ancient PowerBook G3 laptop running MacOS X that is being pushed
> fairly hard to just run the OS and keep a few programs in memory, much
> less do anything useful.
>
> Contrariwise, Steve is running on a Soekris 4801 single board
> computer which is pretty much otherwise unloaded (except for ntpd),
> running a fairly stripped version of FreeBSD, and I believe he's
> connected to his cable modem line directly via 10/100 Base-T/TX Ethernet
> as opposed to WLAN.
>
> I don't know how much of my slow down is due to what factors, but
> I'm not too surprised.
>
Maybe a large part of your ntpdate time was printing out the messages.
There was some question earlier about whether DNS delays might
explain the lengthy time for ntpd. So I performed the same experiment
on the same system, which is its own DNS server, caching the
names first, and doing ntpdate before ntpd to make doubly sure.
There is no meaningful difference.
Starting with:
# cat /etc/ntp.drift
-2.300
# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
LOCAL(1) LOCAL(1) 5 l 9 64 377 0.000 0.000 0.004
[network].255 0.0.0.0 16 u - 64 0 0.000 0.000 4000.00
-[name] .TRUE. 1 u 752 1024 377 30.571 6.192 8.958
-[name] .WWVB. 1 u 694 1024 377 0.176 2.184 1.237
-[name] [name] 2 u 888 512 156 0.004 1.563 1.258
+[name] .GPS. 1 u 671 1024 377 87.984 0.651 0.047
+[name*] .GPS. 1 u 752 1024 377 88.089 0.590 0.055
*[name] .GPS. 1 u 338 1024 377 87.950 0.649 0.014
-[name] .GPS. 1 u 749 1024 377 73.684 0.285 0.227
#[name] [name] 2 u 811 1024 377 83.563 0.551 0.681
-[name] .GPS. 1 u 766 1024 377 32.532 1.301 1.149
-[name] .GPS. 1 u 401 1024 377 105.854 0.586 0.048
-[name*] .GPS. 1 u 771 1024 377 92.284 3.090 0.076
#[name] [name] 2 u 106 1024 377 0.512 1.809 0.057
#[name*] [name*] 2 u 463 1024 376 9.281 1.583 0.269
[name] 0.0.0.0 16 u - 1024 0 0.000 0.000 4000.00
[name*] = servers chosen for ntpdate/ntpd -gq
All are on an internal network, physical distances from feet to 3000 miles.
Delays from home across my own wireless onto the Internet to servers 3000
miles away are 93 milliseconds, so I wouldn't put much faith in that
as an important difference.
[shut down ntpd]
# time ntpdate -b [3 servers]
5 Feb 22:58:12 ntpdate[234803]: step time server [IP] offset -0.000136 sec
real 0m0.71s [you'll recall that with all the above servers, including
user 0m0.00s the one that's down, this still took only 6.73 seconds]
sys 0m0.00s
# time ntpd -gq -c ntp.boot [same 3 servers, iburst minpoll 4]
ntpd: time slew 0.001556s
real 0m41.01s
user 0m0.06s
sys 0m0.60s
# time ntpd -gq -c ntp.boot [same 3 servers, iburst minpoll 1]
ntpd: time slew 0.002653s
real 0m37.00s
user 0m0.10s
sys 0m0.56s
-Tom
More information about the questions
mailing list