Network Time Protocol (NTP) - Computerphile

preview_player
Показать описание
Just how do computers synchronise clocks across the Internet? Dr Julian Onions implemented this at Nottingham after meeting the godfather of Internet time, Dave Mills!


This video was filmed and edited by Sean Riley.


Рекомендации по теме
Комментарии
Автор

A Computerphile video on NTP? It's about time.

kasamialt
Автор

More protocols with people who were there to see them written please! I love the anecdotes

TomWhi
Автор

As a network engineer I use NTP every day, but never actually knew how it worked. - Thanks for the explanation

tonymurphy
Автор

The reason why you back off the polling interval is to allow the effect of the frequency error between the two NTP peers to accumulate enough phase error that can be detectable. There's also some cool algorithms at work here, where as you get closer to the synchronizing the correct local clock frequency, you '"tighten up" the phased-locked loop that's corrected by measured clock offsets (after going through a filter). The clock offset computation also needs to have half of the measured delay time accounted for (which was missing in the video.) Of course, this assumes that the network latency across the network path is symmetric... which isn't always the case. Along with the NTP peer stratum number, another metric, "dispersion" is measured between NTP peers which is roughly how noisy the measurement is. An NTP peer will include the "root dispersion" which is the sum of the dispersions of that peer to the root of that synchronization hierarchy and a measurement of the quality.

NTP is great fun. Along with Mike Petry, he and I built the first UNIX NTP implementation of the protocol, doing so only from the draft protocol document and peeking at the PDP-11 assembly code that Dave's implementation was built in. Mike and I were students of Dave's at the University of Maryland and enjoyed many time synchronization experiences ourselves.

I built the NTPv1 UNIX implementation on a NeXT workstation in my office. One of the things the NTP program does is compute the intrinsic frequency error of the clock in your computer. It saves this in a file, so that in the event you lose connectivity to your synchronization peer, you can continue to apply the frequency correction, so at least your clock advances at a more correct rate than it would otherwise. From this, I could indirectly measure the temperature of the room as the cheap crystal on the computer's board had a relatively poor temperature coefficient, and it became clear that that the air conditioning in the office got turned off over the weekends and the ambient temperature would rise.

And then there were the exciting New Year's Eve experiences! Will the code that handles leap-second insertion work correctly? A leap second is most frequently inserted at 23:59:59 UTC on 31 December, so about 7pm local time. I would disappear into my home office and watch NTP to see if the right thing would happen.. And then struggle to explain to family and friends why this had to happen right now..

Nice video! How novel to see NTP make an appearance on YouTube!

lmamakos
Автор

I studied under Dr Mills. People would occasionally look at a file system / database protocol and say "But what if the client isn't sync'ed to the server?" He'd say "We solved that problem. Let's move on."

darrennew
Автор

Beyond NTP, for high precision time for science experiments and such (e.g. the LHC, or radio telescopes doing VLBI), there's White Rabbit developed at CERN. It can synchronize clocks to under a nanosecond over local distances (tens of km). I used to work in a place that had a dedicated optical fibre running 50 km from the national lab with atomic clocks to sync some radio telescope clocks.

OlliWilkman
Автор

Brilliant! One of the things I love about computer science is that a lot of the people who worked on all these methods and algorithms are still around.
Getting information straight from the source is always amazing, especially when its produced and presented as well as you do!

juliankandlhofer
Автор

Rest in peace David L. Mills. We stand on the shoulders of giants.

picoplanetdev
Автор

A few years ago I moved from pure networking to networking/system administration in a very small company. Server care and maintenance hadn't happened for a while when I arrived and everything was a bit tottery and unstable.
I wasn't quite sure what the best approach was but got NTP working across all servers, whether they talked to the outside world or not. This was the crucial first step to stabilising servers and their (inter-server) services. Thanks NTP, you are a winner!

vholes
Автор

Back in the early 90s, I'd just started getting into Linux. I was running an Yggdrasil distribution on a 80486 (kernel versión 0.99PL14R).
And I started hanging out with a local user's group - Unix Users of Minnesota.
NTP clients had just started showing up for Linux, and all us geeks were busy getting things configured.
So I'm waiting for the meeting to start, chatting with folks, and the moderator gets up behind the podium to kick things off.
And then it turned 7:00 o'clock, and everybody's watch beeped.
This was, of course, back in the day when people still thought digital watches were a pretty neat idea.
There must have been thirty of us, perhaps twenty had watches with hour-beeps turned on, and we all of us beeped at exactly the same time.
We'd all synced to our computers, and our computers were all synced to Internet time.

jeffdege
Автор

I remember people arguing about whose watch had the correct time. The only way to truly settle the argument was to fire up the shortwave radio and tune it to WWV in Fort Collins. Thanks to NTP and smartphones those tedious arguments are a thing of the past

DavidRexGlenn
Автор

It's really great that at 0:32 and 6:55 you can see a drawing of an 8 bit BBC Micro computer from the 80's. I have build a WiFi board for this computer and a friend of mine, Timo, wrote a program that fetches the time from a NTP server 🙂 Thanks for this explanation Mr Onions.

RolandLeurs
Автор

The underlying architecture for the global NTP Pool is a really interesting as well. It was one of the first instances of GeoDNS to silently get clients connected to the closest regional servers

ClifBratcher
Автор

There's just something wonderful about seeing multiple clocks perfectly synced. I love NTP

GeekIWG
Автор

NTP came out in 1985. Prime computers didn't have crystal clocks. It was quite a chore to synchronize the clocks. The clock could only be set at the console. When time was set, it started at the indicated minute; there were no seconds. I wrote a program to query the other computers on the ringnet and set the clock. Some computers had more accurate clocks than others. The program had a list of computers from best to worst. If the best computer was unavailable, it would drop to the next. There was also code to do a sanity check if times were too divergent from each other. The time synchronization was added to the backup script because it was run daily from the console.

BlankBrain
Автор

A student in my uni class did his dissertation that included a case of using NTP in a method of DDOS attack around 2014 (the "derp trolling" group, if that rings a bell for anyone). At the time it broke records on both total bandwidth used up in an attack and the return they got for every bit they sent (I think it was in the 400 bits per bit sent amounts?)

JadedWallace
Автор

I’d love to see a video expanding on this to PTP!

HOYS
Автор

If you're able to ask the guy who spent half his life watching clocks about an interview, it would definitely be worth a watch too

CMDRunematti
Автор

This is awesome. Can we get one of these for Precision Time Protocol?

McTroyd
Автор

In years past I really enjoyed looking at the delay-offset scatter plots from ntp's peerstats data. It reveals interesting network details like the asymmetry in DSL links, or big changes in global routing. A "network weather monitor" of sorts. Search for the great write up on a focus on NTP in Slovenia to see some of these scatter plots.

cedarmyers