NTP Precision Time Synchronization



Similar documents
Survivable, Real Time Network Services

Network Time Protocol (NTP) General Overview

Internet Timekeeping Around the Globe 1,2

Precision Time Protocol (PTP/IEEE-1588)

HANDBOOK. Measuring System DESIGN EDITORS PETER H. SYDENHAM RICHARD THORN ARTICLE OFFPRINT

3.7. Clock Synch hronisation

Precision Time Protocol on Linux ~ Introduction to linuxptp

Timer A (0 and 1) and PWM EE3376

Secure SCADA Communication Protocol Performance Test Results

The Role of Precise Timing in High-Speed, Low-Latency Trading

Evaluating the Accuracy of Maxim Real-Time Clocks (RTCs)

Optimizing VCO PLL Evaluations & PLL Synthesizer Designs

MicroMag3 3-Axis Magnetic Sensor Module

A High Resolution Performance Monitoring Software on the Pentium

Wide Area Monitoring, Control, and Protection

Computer Time Synchronization

Distributed Synchronization

DS1104 R&D Controller Board

Design Issues in a Bare PC Web Server

Time Calibrator Fountain Computer Products

A PC-BASED TIME INTERVAL COUNTER WITH 200 PS RESOLUTION

DAC Digital To Analog Converter

Synchronization in. Distributed Systems. Cooperation and Coordination in. Distributed Systems. Kinds of Synchronization.

Enabling Open-Source High Speed Network Monitoring on NetFPGA

CLOCK AND SYNCHRONIZATION IN SYSTEM 6000

DEVELOPMENT OF DEVICES AND METHODS FOR PHASE AND AC LINEARITY MEASUREMENTS IN DIGITIZERS

A Laser Scanner Chip Set for Accurate Perception Systems

Tivoli IBM Tivoli Web Response Monitor and IBM Tivoli Web Segment Analyzer

Glitch Free Frequency Shifting Simplifies Timing Design in Consumer Applications

Technical Bulletin. Enabling Arista Advanced Monitoring. Overview

The new frontier of the DATA acquisition using 1 and 10 Gb/s Ethernet links. Filippo Costa on behalf of the ALICE DAQ group

Abstract. Cycle Domain Simulator for Phase-Locked Loops

Non-Data Aided Carrier Offset Compensation for SDR Implementation

Section 3. Sensor to ADC Design Example

TI GPS PPS Timing Application Note

Timing Errors and Jitter

Contents. Connection Guide. What is Dante? Connections Network Set Up System Examples Copyright 2015 ROLAND CORPORATION

USB 3.0 CDR Model White Paper Revision 0.5

Time Synchronization & Timekeeping

Computer Time Synchronization

APPLICATION NOTE GaGe CompuScope based Lightning Monitoring System

The Model A032-ET of Riga Event Timers

Communicating with devices

Chapter 3 Operating-System Structures

How To Run A Gps Time Server In A Gpx Device In A Powerbox (Gps) On A Gpm (Gpl) Or Ipa (Gpt) Device

QAM Demodulation. Performance Conclusion. o o o o o. (Nyquist shaping, Clock & Carrier Recovery, AGC, Adaptive Equaliser) o o. Wireless Communications

Kepware Technologies Optimizing KEPServerEX V5 Projects

Choosing the correct Time Synchronization Protocol and incorporating the 1756-TIME module into your Application

The Central Processing Unit:

Clocks/timers, Time, and GPS

Gigabit Ethernet Packet Capture. User s Guide

Precision Clock Synchronization

Selecting the Optimum PCI Express Clock Source

find model parameters, to validate models, and to develop inputs for models. c 1994 Raj Jain 7.1

PNOZmulti Configurator V8.1.1

Department of Electrical and Computer Engineering Ben-Gurion University of the Negev. LAB 1 - Introduction to USRP

Developing Wireless GPIB Test Systems Using the GPIB-ENET/100

Lecture 3 Theoretical Foundations of RTOS

Phase coherency of CDMA caller location processing based on TCXO frequency reference with intermittent GPS correction

The Lagopus SDN Software Switch. 3.1 SDN and OpenFlow. 3. Cloud Computing Technology

LoRa FAQs. 1 of 4 Semtech. Semtech Corporation LoRa FAQ

Best Practises for LabVIEW FPGA Design Flow. uk.ni.com ireland.ni.com

Extended Resolution TOA Measurement in an IFM Receiver

CONTROL MICROSYSTEMS DNP3. User and Reference Manual

NIST Computer Time Services: Internet Time Service (ITS), Automated Computer Time Service (ACTS), and time.gov Web Sites

Serial Communications

Software Stacks for Mixed-critical Applications: Consolidating IEEE AVB and Time-triggered Ethernet in Next-generation Automotive Electronics

Evaluating 1588v2 Performance Rev 2

Time Synchronization of Computer in secure manner while using Teleclock & NTP Services

Atmel Norway XMEGA Introduction

Chapter 6: From Digital-to-Analog and Back Again

Swiss Time Systems. The new multipurpose time server for the LAN and NTP-based Distributed Time System. by MOBATIME DTS 4138.

Computer Systems Structure Input/Output

Below is a diagram explaining the data packet and the timing related to the mouse clock while receiving a byte from the PS-2 mouse:

Real-time Process Network Sonar Beamformer

How To Monitor And Test An Ethernet Network On A Computer Or Network Card

AVR131: Using the AVR s High-speed PWM. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

Delivering NIST Time to Financial Markets Via Common-View GPS Measurements

Hello, and welcome to this presentation of the STM32L4 reset and clock controller.

Interfacing Analog to Digital Data Converters

Simple SDR Receiver. Looking for some hardware to learn about SDR? This project may be just what you need to explore this hot topic!

What You Will Learn About. Computers Are Your Future. Chapter 8. Networks: Communicating and Sharing Resources. Network Fundamentals

Performance Evaluation of Linux Bridge

Computer-System Architecture

Description: Multiparameter System (4 or 8 channels)

GPS NTP TIME SERVER Rack Version V2

HD Radio FM Transmission System Specifications Rev. F August 24, 2011

Design and Implementation of One-way IP Performance Measurement Tool

AN NTP STRATUM-ONE SERVER FARM FED BY IEEE-1588

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

White Paper. Real-time Capabilities for Linux SGI REACT Real-Time for Linux

SYSTEM ecos Embedded Configurable Operating System

8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation.

The Bus (PCI and PCI-Express)

A Transport Protocol for Multimedia Wireless Sensor Networks

Using Network Time Protocol (NTP): Introduction and Recommended Practices

AVR32788: AVR 32 How to use the SSC in I2S mode. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

Application of Android OS as Real-time Control Platform**

Transcription:

NTP Precision Time Synchronization David L. Mills University of Delaware http://www.eecis.udel.edu/~mills mailto:mills@udel.edu alautun, Maya glyph From pogo, Walt Kelly 5-Jul-08 1

Precision time performance issues Improved clock filter algorithm reduces network jitter Operating system kernel modifications achieve time resolution of 1 ns and frequency resolution of.001 PPM using NTP and PPS sources. With kernel modifications, residual errors are reducec to less than 2 μs RMS with PPS source and less than 20 μs over a 100-Mb LAN. New optional interleaved on-wire protocol minimizes errors due to output queueing latencies. With this protocol and hardware timestamps in the NIC, residual errors over a LAN can be reduced to the order of PPS signal. Using external oscillator or NIC oscillator as clock source, residual errors can be reduced to the order of IEEE 1588 PTP. Optional precision timing sources using GPS, LORAN-C and cesium clocks. 5-Jul-08 2

Part 1 quick fixes Assess errors due to kernel latencies Reduce sawtooth errors due to software frequency discipline Reduce network jitter using the clock filter Minimize latencies in the operating system and network 5-Jul-08 3

Errors due to kernel latencies (a) Latency for getimeofday() Call (b) Latency Distribution for (a) These graphs were constructed using a Digital Alpha and OSF/1 V3.2 with precision time kernel modifications (a) Measured latency for gettimeofday() call spikes are due to timer interrupt routine (b) Probability distribution for (a) measured over about ten minutes Note peaks near 1 ms due timer interrupt routine, others may be due to cache reloads, context switches and time slicing Biggest surprise is very long tail to large fractions of a second 5-Jul-08 4

Sawtooth errors due to software frequency discipline θ Adjustment Interval σ +S A C t ε S Adjustment Rate R ϕ B Frequency Error ϕ Unix adjtime() slews frequency at net rate R ϕ PPM beginning at A Slew continues to B, depending on the programmed frequency offset S Offset continues to C with frequency offset due to error ϕ 1 1 If ε x, then R ϕ + S and σ + x ϕ R ϕ For ε = 100 μs, ϕ = 200 PPM, S = 200 PPM, this requires R 400 PPM and σ 1 s These are almost completely eliminated using kernel discipline 5-Jul-08 5

Cumulative distribution function of network latencies This cumulative distribution function is from the same day as the time offset slide The rightmost curve represents raw offsets received over the network. The left curve represents the offsets after the clock filter algorithm. 5-Jul-08 6

CDF in log-log coordinates long term 10 0 10 1 P[Offset < y] 10 2 10 3 10 4 10 5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 Offset (ms) These data are from other sources The interesting observation is that these lines are almost straight, but with different slope. The awesome fact is they keep going. 5-Jul-08 7

Latencies in the operating system and network Cryptosum Output Wait Network Input Wait Cryptosum and Protocol Processing Time T 3b Timestamp T 3a Timestamp T 3 Timestamp T 4 Timestamp T 4a Timestamp We want T 3 and T 4 timestamps for accurate network timing If output wait is small, T 3a is good approximation to T 3 T 3a can t be included in message after cryptosum is calculated, but can be sent in next message; if not, use T 3b as best approximation to T 3 T 4a is captured at soft-queue interrupt time, so is a fairly good estimator for T 4. Largest error is usually cryptosum and output wait With software timestamping, T 3 is captured upon return from the sendpacket routine, typically 200 μs after T 3a. With interleaved protocol, T 3 is transmitted in the next packet. See http://www.eecis.udel.edu/~mills/onwire.html and related briefing. 5-Jul-08 8

Measured latencies with software interleaved timestamping The interleaved protcool captures T 3b before the message digest and T 3 after the send-packet routine. The difference varies from 16 μs for a dual-core, 2.8 GHz Pentium 4 running FreeBSD 5.1 to 1100 μs for a Sun Blade 1500 running Solaris 10. On two identical Pentium machines in symmetric mode, the measured output delay T 3b to T 3 is 16 μs and interleaved delay 2x T 3 to T 4a is 90-300 μs. Four switch hops at 100 Mb accounts for 40 μs, which leaves 25-130 μs at each end for input delay. The RMS jitter is 30-50 μs. On two identical UltraSPARC machines running Solaris 10 in symmetric mode, the measured output delay T 3b to T 3 is 160 μs and interleaved delay 2x T 3 to T 4a is 390 μs. Four switch hops accounts for 40 μs, which leaves about 175 μs at each end for input delay. The RMS jitter is 40-60 μs. A natural conclusion is that most of the jitter is contributed by the network and input delay. 5-Jul-08 9

So, how well does it work? We measure the max, mean and standard deviation over one day The mean is an estimator of the offset produced by the clock discipline, which is essentially a lowpass filter. The standard deviation is a estimator for jitter produced by the clock filter. Following are three scenarios with modern machines and Ethernets The best we can do using the precision time kernel and a PPS signal from a GPS receiver. Expect residual errors in the order of 2 μs dominated by hardware and operating system jitter. The best we can do using a workstation synchronized to a primary server over a fast LAN using optimum poll interval of 15 s. Expect residual errors in the order of 20 μs dominated by network jitter. The best we can do using a workstation synchronized to a primary server over a fast LAN using typical poll interval of 64 s. Expect errors in the order of 200 μs dominated by oscillato rwander. Next order of business is the interleaved on-wire protocol and hardware timestamping. The goal is improving network perfomance to PPS level. 5-Jul-08 10

Time characteristis with PPS kernel discipline Machine is Pentium II 300 MHz running FreeBSD 6.1 and synchronized to a GPS receiver via a PPS signal and parallel port Precision nanokernel PPS discipline NTP4 is configured at fixed poll interval 4 (16 s) Behavior appears largely determined by hardware/kernel latencies 5-Jul-08 11

Time offset CDF with PPS kernel discipline Same configuration as previous slide Note log-log coordinates Offset statistics: max 5.749 μs, mean -0.039 μs, stdev 1.357 μs 5-Jul-08 12

Frequency characteristis with PPS kernel discipline Same configuration as previous slide Comparison with the time offset characteristics suggest the dominant error contribution is latency jitter rather than frequency discipline. Compare with later data on a typical machine over a fast LAN 5-Jul-08 13

Time characteristis with fast LAN and poll 16 s Machine is UltraSPARC II running Solaris 10 and synchronized to a primary server connected to GPS receiver via a PPS signal NTP4 is configured at fixed poll interval 4 (16 s) Behavior appears largely determined by 100 Mb Ethernet latencies 5-Jul-08 14

Time offset CDF with fast LAN and poll 16 s Same configuration as previous slide Note log-log coordinates Offset statistics: max 57.000 μs mean -0.833 μs stdev 16.078 μs About ten times worse than PPS signal 5-Jul-08 15

Frequency characteristis with fast LAN and poll 16 s Same configuration as previous slide Comparison with the time offset characteristics suggest the dominant error contribution is latency jitter rather than frequency discipline. Compare with earlier data with a PPS signal 5-Jul-08 16

Time characteristis with fast LAN and poll 64 s Machine is Pentium 2.8 GHz running FreeBSD 6.1 and synchronized to a CDMA receiver on a 100 Mb switched Ethernet CDMA receiver claimed accuracy is 10 μs NTP4 is configured at fixed poll interval 6 (64 s) Behavior appears largely determined by oscillator wander 5-Jul-08 17

Frequency characteristis with fast LAN and poll 64 s These data are from the same day as the time offset slide The curve approximates the integral of the time offset data This clearly confirms the errors are primarily due to frequency wander Accuracy improves as the poll interval is reduced, but not below 16 s due increased frequency wander 5-Jul-08 18

Not so-quick fixes Autokey public key cryptography Avoids errors due to cyrptographic computations See briefing and specification Precision time nanokernel Improves time and frequency resolution Avoids sawtooth error Improved driver interface Includes median filter Adds PPS driver External oscillator/nic oscillator With interleaved protocol, performance equivalent to IEEE 1588 LORAN C receiver and precision clock source 5-Jul-08 19

Avoid inline public-key algorithms: the Autokey protocol Source Address Dest Address Key ID Last Session Key MD5 Hash (Session Key) Session Key List RSA Encrypt Server Private Key Next Key ID Server Key Server rolls a random 32-bit seed as the initial key ID Server generates a session key list using repeated MD5 hashes Server encrypts the last key using RSA and its private key to produce the initial server key and provides it and its public key to all clients Server uses the session key list in reverse order, so that clients can verify the hash of each key used matches the previous key Clients can verify that repeated hashes will eventually match the decrypted initial server key 5-Jul-08 20

Kernel modifications for nanosecond resolution Nanokernel package of routines compiled with the operating system kernel Represents time in nanoseconds and fraction, frequency in nanoseconds per second and fraction Implements nanosecond system clock variable with either microsecond or nanosecond kernel native time variables Uses native 64-bit arithmetic for 64-bit architectures, double-precision 32-bit macro package for 32-bit architectures Includes two new system calls ntp_gettime() and ntp_adjtime() Includes new system clock read routine with nanosecond interpolation using process cycle counter (PCC) Supports run-time tick specification and mode control Guaranteed monotonic for single and multiple CPU systems 5-Jul-08 21

NTP clock discipline with nanokernel assist NTP θ r + θ c Phase Detector V d Clock Filter V s NTP Daemon 1 GHz VFO V c Clock Adjust Loop Filter x y Phase/Freq Prediction Kernel PPS Type II, adaptive-parameter, hybrid phase/frequency-lock loop disciplines variable frequency oscillator (VFO) phase and frequency NTP daemon computes phase error V d = θ r θ o between source and VFO, then grooms samples to produce time update V s Loop filter computes phase x and frequency y corrections and provides new adjustments V c at 1-s intervals VFO frequency adjusted at each hardware tick interrupt 5-Jul-08 22

Nanokernel phase/frequency prediction NTP Update V s PLL/FLL Discipline x y PPS Interrupt PPS Discipline x y Switch x y PLL/FLL discipline predicts phase x and frequency y at averaging intervals from 1 s to over one day. PPS discipline predicts x and y at averaging intervals from 4 s to 128 s, depending on nominal Allan intercept. On overflow of the clock second, new values for time θ and frequency φ offset are calculated. Phase adjustment αθ + φ is added to system clock for α < 1 at every tick interrupt, then θ is reduced by (1 α)θ. 5-Jul-08 23

NTP phase and frequency discipline Check and Groom x NTP Update V s FLL Freq Average y FLL Switch y PLL Freq Integrate y PLL x is the phase correction initially set at the update value. y FLL is the frequency prediction computed as the average of past update differences. y PLL is the frequency prediction computed as the integral of past update values. The switch controlled by the API selects which of y FLL or y PLL are used. 5-Jul-08 24

PPS phase and frequency discipline Second Offset Latch Median Filter Check and Groom x PPS Interrupt Range Gate Frequency Discrim Scaled PCC 1 GHz Latch Check and Groom Frequency Average y Phase and frequency disciplined separately - phase from system clock second offset, frequency from processor cycle counter (PCC) Frequency discriminator rejects noise and invalid signals Median filter rejects sample outlyers and provides error statistic Check and groom rejects popcorn spikes and clamps outlyers Phase offsets exponentially averaged with variable time constant Frequency offsets averaged over variable interval 5-Jul-08 25

Nanosecond clock Time of Day Add Interpolation Scale 1 GHz System Clock PCC 433 MHz 1024 Hz Timer Add z 1024 1 Hz Second x z = + y τ x x = x τ Phase x and frequency y are updated by the PLL/FLL or PPS loop. At the second overflow increment z is calculated and x reduced by the time constant. The increment is amortized over the second at each tick interrupt. Time between ticks is interpolated from the PCC scaled to 1 GHz. 5-Jul-08 26

Reference clock drivers Peer Filter 1 Reference Driver PPS Driver Filter 2 Filter 3 Selection and Clustering Algorithms Combining Algorithm System Process Loop Filter Clock Adj. Proc. Clock Drivers Peer Processes VFO Reference clock drivers work just like NTP peers. Active drivers produce timecode message in response to poll message. Passive drivers provide timecode registers that can be read by poll routine. PPS driver augments prefer peer for precision time. Offset only within the second; seconds numbering must be provided by reference driver or NTP peer. PPS believed only if prefer peer correct and within 128 ms. 5-Jul-08 27

Reference clock driver interface Receive Driver Parse Timecode Driver Timestamp Poll System Clock Timestamp Median Filter Clock Filter PPS (optional) Driver timecode is read either by timecode message interrupt or poll routine. Timecode and associated data are parsed according to specific format. Offset is computed between driver timestamp and system clock timestamp. Offsets accumulate in median filter shift register until processed and sent to clock filter.. Optional PPS signal (PPS driver only) provides offset in second. 5-Jul-08 28

Minimize effects of serial port hardware and driver jitter Graph shows raw jitter of millisecond timecode and 9600-bps serial port Additional latencies from 1.5 ms to 8.3 ms on SPARC IPC due to software driver and operating system; rare latency peaks over 20 ms Latencies can be minimized by capturing timestamps close to the hardware Jitter is reduced using median/trimmed-mean filter of 60 samples Using on-second format and filter, residual jitter is less than 50 μs 5-Jul-08 29

Precision time and frequency sources KSI/Odetics TPRO IRIG-B SBus interface Provides direct-reading microsecond clock in BCD format Synchronized to GPS receiver using IRIG-B signal Supported both as an NTP driver and as kernel system clock Stabilizes time to 1 μs and frequency to 0.1 PPM Precision oven-stabilized system clock SBus memory-mapped interface Provides direct-reading microsecond clock in Unix timeval format Supported as kernel system clock Stabilizes time via radio or NTP and frequency to.005 PPM PPS discipline Driver or kernel interface via modem control line Stabilizes frequency to.001 PPM relative to external 1-PPS source Stabilizes time within 1 μs with seconds numbered by NTP 5-Jul-08 30

Hardware clock discipline 0-999,999 μs Latch Read 0-999,999 μs Latch Read Counter Counter VCXO f f/n Prescaler TCXO f f/n DDS ±1 DAC Latch Latch a I/O Bus b Analog (a) and digital (b) frequency discipline methods Analog method uses voltage-controlled low-frequency oscillator. Digital method uses direct digital synthesis and high-frquency oscillator. Either method could be used in a NIC or bus peripheral 5-Jul-08 31

Gadget Box PPS interface Used to interface PPS signals from GPS receiver or cesium oscillator Pulse generator and level converter from rising or falling PPS signal edge Simulates serial port character or stimulates modem control lead Also used to demodulate timecode broadcast by CHU Canada Narrowband filter, 300-baud modem and level converter The NTP software includes an audio driver that does the same thing 5-Jul-08 32

LORAN-C timing receiver Inexpensive second-generation bus peripheral for IBM 386-class PC with oven-stabilized external master clock oscillator Includes 100-kHz analog receiver with D/A and A/D converters Functions as precision oscillator with frequency disciplined to selected LORAN-C chain within 200 ns of UTC(LORAN) and 10-10 stability PC control program (in portable C) simultaneously tracks up to six stations from the same LORAN-C chain Intended to be used with NTP to resolve inherent LORAN-C timing ambiguity 5-Jul-08 33

Further information NTP home page http://www.ntp.org Current NTP Version 3 and 4 software and documentation FAQ and links to other sources and interesting places David L. Mills home page http://www.eecis.udel.edu/~mills Papers, reports and memoranda in PostScript and PDF formats Briefings in HTML, PostScript, PowerPoint and PDF formats Collaboration resources hardware, software and documentation Songs, photo galleries and after-dinner speech scripts Udel FTP server: ftp://ftp.udel.edu/pub/ntp Current NTP Version software, documentation and support Collaboration resources and junkbox Related projects http://www.eecis.udel.edu/~mills/status.htm Current research project descriptions and briefings 5-Jul-08 34