Middleware and Distributed Systems. Time. Martin v. Löwis. Mittwoch, 22. Februar 12

Similar documents
Distributed Systems. Clock Synchronization: Physical Clocks. Paul Krzyzanowski

Distributed Systems. 05. Clock Synchronization. Paul Krzyzanowski. Rutgers University. Fall 2017

Clock-Synchronisation

INTERNATIONAL JOURNAL OF ENGINEERING SCIENCES & RESEARCH TECHNOLOGY

Synchronization Part 1. REK s adaptation of Claypool s adaptation of Tanenbaum s Distributed Systems Chapter 5

Lecture 12: Time Distributed Systems

Lecture 10: Clocks and Time

Synchronization of Network Devices Time by GPS Based Network Time Protocol Output


Time Synchronization and Logical Clocks

Synchronisation in. Distributed Systems. Co-operation and Co-ordination in. Distributed Systems. Kinds of Synchronisation. Clock Synchronization

Network Working Group. Obsoletes: 1361 March 1995 Category: Informational

Time in Distributed Systems

CSE 124: TIME SYNCHRONIZATION, CRISTIAN S ALGORITHM, BERKELEY ALGORITHM, NTP. George Porter October 27, 2017

殷亚凤. Synchronization. Distributed Systems [6]

Time. COS 418: Distributed Systems Lecture 3. Wyatt Lloyd

CSE 5306 Distributed Systems. Synchronization

The ISP Column A monthly column on things Internet. Protocol Basics: The Network Time Protocol. NTP, Time, and Timekeeping. March 2014 Geoff Huston

DISTRIBUTED REAL-TIME SYSTEMS

Last Class: Naming. Today: Classical Problems in Distributed Systems. Naming. Time ordering and clock synchronization (today)

Time Synchronization and Logical Clocks

Last Class: Naming. DNS Implementation

Distributed Systems COMP 212. Lecture 17 Othon Michail

Time Scales and Time Keeping in the 21 st Century

Distributed Systems. Time, clocks, and Ordering of events. Rik Sarkar. University of Edinburgh Fall 2014

TIME ATTRIBUTION 11/4/2018. George Porter Nov 6 and 8, 2018

Time. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 37

Clock and Time. THOAI NAM Faculty of Information Technology HCMC University of Technology

Distributed Coordination 1/39

Implementing NTP. Release 3.8.0

Synchronization. Clock Synchronization

Table of Contents 1 NTP Configuration 1-1

Irish NTP Subnet. Performance Issues. Hugh Melvin & Paraic Quinn. Dept. of Information Technology NUI,G

CSE 5306 Distributed Systems

Implementing a NTP-Based Time Service within a Distributed Middleware System

Issues and Challenges Facing Traceable Accurate Time Delivery

Verteilte Systeme (Distributed Systems)

Synchronization. Distributed Systems IT332

Implementing NTP. Support was added for IPv6 addresses, VRFs, multicast-based associations, and burst and iburst modes for poll-based associations.

Operation Manual NTP. Table of Contents

Chapter 6 Ti T me m s ynchronization

The Network Computer as Precision Timekeeper

Network Time Protocol

Synchronization. Chapter 5

Realization and maintenance of UTC

Advanced Topics in Distributed Systems. Dr. Ayman A. Abdel-Hamid. Computer Science Department Virginia Tech

The Timed Asynchronous Distributed System Model By Flaviu Cristian and Christof Fetzer

HP 6125 Blade Switch Series

HP 6125G & 6125G/XG Blade Switches

Distributed Operating Systems. Distributed Synchronization

2. Time and Global States Page 1. University of Freiburg, Germany Department of Computer Science. Distributed Systems

2. Clock Accuracy and Synchronization

Clock Synchronization

Wrangling a Large Herd of Internet Clocks

Experiment on Cristian s and Berkeley Time Synchronization Algorithms

Configuring NTP. Information About NTP. Information About the NTP Server. This chapter contains the following sections:

Network Time Service SY-GPS-1-A

Reliable Time Synchronization Protocol for Wireless Sensor Networks

Time Handling in Programming Language

GPS IRIG-B/NTP Time Server GPS-2-E-NTP

18-642: Time and Date

Configuring NTP. Information About NTP. This chapter contains the following sections:

Network Time Protocol

Configuring NTP. Information About NTP. Information About the NTP Server. This chapter contains the following sections:

Configuring NTP. Information About NTP. This chapter contains the following sections:

Wireless Communication Bluetooth, Timing

Data Management. Data Quality and Time Synchronization. Gino Crispieri - ISMI

Internet Engineering Task Force (IETF) Category: Standards Track ISSN: March 2014

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

Timing in Packet Networks. Stefano RUffini 9 March 2015

The UTC Time Scale: Internet timing issues

The Flooding Time Synchronization Protocol

TCG 01-G & TCG 02-G Firmware Release Notes

One-way Delay Measurement Using NTP

Survivable Real-Time Network Services

Clock Synchronization. Synchronization. Clock Synchronization Algorithms. Physical Clock Synchronization. Tanenbaum Chapter 6 plus additional papers

This chapter describes how to configure the Network Time Protocol (NTP) on Cisco NX-OS devices. This chapter includes the following sections:

Tutorial: Network-based Frequency, Time & Phase Distribution

USING THE NETWORK TIME PROTOCOL (NTP) TO TRANSMIT INTERNATIONAL ATOMIC TIME (TAI)

The IEEE 1588 Standard

Distributed Synchronization. EECS 591 Farnam Jahanian University of Michigan

Implementing NTPv4 in IPv6

1. Introduction How do hosts and gateways in a large, dispersed networking community know what time it is? How accurate are their clocks?

Ad hoc and Sensor Networks Time Synchronization

Failure Tolerance. Distributed Systems Santa Clara University

RME-V01. Digital Instruments. Time and Reference Measurement System

Configuring Precision Time Protocol (PTP)

µtasker Document µtasker SNTP (Simple Network Time Protocol)

Distributed Systems Exam 1 Review. Paul Krzyzanowski. Rutgers University. Fall 2016

Configuring NTP. Information About NTP. Information About the NTP Server. This chapter contains the following sections:

Fault Tolerance. Distributed Software Systems. Definitions

A legal transactions, transportation and distribution systems

Distributed Systems. Pre-Exam 1 Review. Paul Krzyzanowski. Rutgers University. Fall 2015

Backbone network technologies. T Jouni Karvo, Timo Kiravuo

IEEE 1588 Hardware Assist

SETTING UP AN NTP SERVER AT THE ROYAL OBSERVATORY OF BELGIUM

Scalable, Autonomous Network Services Configuration

Time in Distributed Systems

IEEE 1588v2 PTP Support

HP 5920 & 5900 Switch Series

Transcription:

Middleware and Distributed Systems Time Martin v. Löwis

Time In Distributed Systems Time is important Timestamp of electronic commerce transactions Some distributed algorithms depend on global time (consistency, authenticity checking, duplicate elimination) Time is problematic in distributed systems Absence of global physical time Local physical clock deviation Order of event pairs from different nodes E.g. distributed garbage collection Time Middleware and Distributed Systems 2

Time In Distributed Systems Collection of N processes pi = p1, p2,..., pn Each process on a single processor, no shared memory, own state si Only message communication - send and receive actions change state Event as communication or state change action Single total ordering of events in one process: history(pi) = ei 0, ei 1, ei 2,... Timestamp for event Physical computer clock: Counting of crystal oscillations, divide count and storage in register as hardware clock value Hi(t) Clock drift: time is counted in different rates in the hardware clock Drift rate: Change in Offset to perfect clock value (10-6 to 10-8, atom clock 10-13 ) Drift rate may change over time (e.g. due to temperature changes) Time Middleware and Distributed Systems 3

Drift Rates Time 1second Quartz Clock 0,000001 seconds 1 minute 0,00006 seconds 1 hour 0,0036 seconds 1 day 0,0864 seconds 1 week 0,6048 seconds ~11.6 days 1 second Time Middleware and Distributed Systems 4

Clock Correctness Correct clock: Error in measured time interval is bounded Additionally, no jumps in time larger than pre-defined drift rate bound Monotonous clock: Clock only ever advances Typical assumption for software clocks (make utility) Hybrid correctness approach: Monotonicity condition, but bounded drift rate only between synchronization points Faulty clock: crash fault (no more ticking) or arbitrary fault Y2K clock: monotonicity condition broken Large drift rate Time Middleware and Distributed Systems 5

Global Time A mean solar second is 1/86400 of a mean solar day Solar day is interval between two consecutive transits (max height) of the sun Solar day has gradually become 1.7 ms longer every century (moon acceleration) 300 million years ago, a year had 400 days Invention of atomic clock in 1948 Counting of transitions of cesium 133 atom, since 1.1.1958 Increasing delay between mean solar time (UT1) and measured atomic time (TAI) International atomic time (TAI - Temps Atomique International) Weighted average of the ticks of around 300 atomic clocks worldwide, e.g. TA(PTB) Publication of latest TA(n) drift to TAI in Circular T publication Managed by Bureau International des Poids et Mesures (BIPM) Time Middleware and Distributed Systems 6

TAI Computation by Pair-Wise Atomic Clock Drift (C) BIPM Time Middleware and Distributed Systems 7

TAI Computation Algorithm from 1973, weighted average calculation every month Pair-wise measurements every 10 days Assumes stable clock frequency over 30 days Linear equations with given difference values Weights of the participating clocks are computed iteratively Take weights from last cycle at start, then always from the last iteration Compute TAI, compute standards deviation of each clock for the last year If smaller than 3.16ns/day, limit weight Zero weight for incorrect clocks Time Middleware and Distributed Systems 8

TAI Correction Factors Ionospheric Maps Operational satellite positioning from International GPS Service (IGS) 1970 s: Different tick rates due to gravitational time dilation Corrections to correspond to proper time at mean sea level TAI slowed down by about 10-12 1990 s: Periodic variations due to blackbody radiation, which varies with ambient temperature Corrections factors to correspond to caesium atom at rest and at absolute zero temperature TAI speed up by 10-14.3 Mobile GPS receiver for GPS hardware callibration factor Time Middleware and Distributed Systems 9

UTC Coordinated Universal Time (CUT) or Temps Universel Coordonné (TUC) Compromise abbreviation UTC by ITU organization Replaced greenwich mean time (astronomical time) with TAI time Zero-point reference for time zones: zulu time Occasionally insertion of leap second (diff > 0.6s), to keep in step with solar time End of June 30 or December 31, decided by IERS Most power companies rely 60Hz / 50Hz timing on UTC clock With leap second, frequency raised to 61Hz or 51Hz for 60 or 50 sec Meanwhile 34 leap seconds in UTC (last on Dec 31, 2008) UTC time by shortwave radio pulse very second (±10ms) or satellite (±0.5 ms) Time Middleware and Distributed Systems 10

Synchronizing physical clocks Synchronized clocks needed for global total ordering of events External synchronization Process clocks must be synchronized with authoritative external source Clocks Ci are accurate to within a given bound D Internal synchronization Synchronization of process clocks with each other, without external reference Clocks Ci agree within a given bound D Externally synchronized system with bound D is internally synchronized with bound 2D Time Middleware and Distributed Systems 11

Interaction Models Synchronous distributed system Lower and upper bound for each process execution step Upper bound for message transmission time Local clock for each process, upper bound for clock drift rate Mostly for theoretical models, hard to build in reality Asynchronous distributed systems Different process execution step times, each with arbitrary length Different message transmission delays Different clock drift rates on each node Time Middleware and Distributed Systems 12

Clock Synchronization In Synchronous System Known bounds for drift rate and transmission delay P1 sends t1 of local clock to P2, which theoretically sets t2 = t1 + Ttrans Ttrans is unknown Uncertainty U( Ttrans) = Tmax - Tmin Receiver can set his clock: t2 = t1 + Tmax or t2 = t1 + Tmin -> clock skew may be as much as U in both cases Receiver can set t2 = t1 + (Tmax + Tmin)/2 -> clock skew is at most U/2 [Lundelius and Lynch 84] Optimum bound on clock skew for N clocks in a synchronous system is U*(1-1/N) Asynchronous system: Unbounded message delays and execution step time Time Middleware and Distributed Systems 13

Old Approaches First protocols in 1983 DAYTIME protocol (RFC 867), port 13 Unspecified ASCII string with date and time Example: time.nist.gov TIME protocol (RFC 868), port 37 32-bit number, number of seconds since 00:00 1 January, 1900 GMT. Time Middleware and Distributed Systems 14

Clock Synchronization (Cristian 89) Central time server with time ts, synchronized with UTC source Estimate roundtrip time between two nodes, since it remains constant Exact local measurement of roundtrip time tround is possible, because of relatively small clock drift rate (1-10 ms LAN, 10-5 ms drift rate) tp = ts + tround/2 (same time for request / reply) With minimum transmission time tmin ts was obtained earliest tmin after sending, and tmin before receiving Accuracy of computed server time is ±(tround/2 - tmin) Time when reply arrives is in range width tround -2tmin Minimal roundtrip time (as known value) brings most accuracy Time Middleware and Distributed Systems 15

Problems with Cristian Algorithm No consideration of faulty clocks Cristian suggested group of synchronized time servers [Dolev 86]: f faulty clocks out of N demands N > 3f for agreement Possibly time jumps on large skews Single roundtrip is possibly inexact multiple measurements with average forming discard runaways Time Middleware and Distributed Systems 16

Clock Synchronization (Gusella and Zatti 89) Berkeley (Unix) algorithm for internal synchronization Master node polls slave nodes, slaves send clock values back Master estimates each roundtrip time, and averages all values Accuracy depends on maximum roundtrip time - longer reads are not considered in the average computation Master sends back adjustment for each slave clock Sending master time would introduce another transmission uncertainty Failed master demands election protocol Faulty slave nodes detected by fault-tolerant average Average for sub-group should not differ too much from other sub-group Time Middleware and Distributed Systems 17

Network Time Protocol (Mills 95) Time synchronization over the Internet Large and variable message delays - statistical techniques for data filtering, different time quality for different servers Stratum 2 Stratum 1 Stratum 2 UTC Source Redundant servers and paths Scalability for large numbers of periodically synchronizing clients Protection with authentication techniques Stratum 3 Stratum 3 Leaf servers executed in users workstation External synchronization Time Middleware and Distributed Systems 18

NTP Terminology Clock stability: How well it can maintain a constant frequency Clock accuracy: How well frequency and time compare to national standard Clock precision: Precision of time quantities Clock offset: Time difference between two clocks Clock skew: Frequency difference between two clocks Clock skew variation: clock drift (assumed zero in NTP) NTP produces clock offset, roundtrip delay and dispersion Clock offset is amount to adjust local clock to reference clock Roundtrip delay allows to launch a message to arrive at specific time Dispersion means the maximum clock offset to reference time Time Middleware and Distributed Systems 19

Demo

Network Time Protocol UDP transport, port 123; oldest protocol in todays s internet Own duplicate detection, single message format Over 230 primary servers, estimated 10-20 million NTP servers NTPv3 in RFC 1305, NTPv4 finished Long periods and multiple comparisons (with low network load) needed Accuracy in order of tens of milliseconds (Internet) or one millisecond (LAN) Operating system kernel adjusts microseconds / clock tick, based on measured clock drift Consideration of time_adj value in each call of update_wall_time_one_tick() (Linux timer.c) Time Middleware and Distributed Systems 21

NTP Algorithm Exchange of timestamps to estimate offset oi between the clocks at Ti and roundtrip delay di=m+m ; Errors due network delays dominate Ti-2=Ti-3+m+oi and Ti=Ti-1+m -oi, therefore di=ti-2-ti-3 + Ti-Ti-1 Estimated offset oi=(ti-2-ti-3 + Ti-1-Ti)/2 o <= Ti-2-Ti-3 and o >= Ti-1-Ti since m, m > 0,leads to oi-di/2 <= o <= oi+di/2 Peer B Ti-2 Ti-1 Server A Ti-3 m m True offset o Ti Time Middleware and Distributed Systems 22

NTP Algorithm Peer 1 Filter 1 Peer 2 Filter 2 Peer 3 Filter 3 NTP Messages Selection and Clustering Algorithms Combining Algorithm Timestamps Clock Discipline Algorithm Loop Filter P/F-Lock Loop VFO (C) David Mills 2004 Computed delay and offset pairs <oi, di> are filtered Statistical quantity expresses the measurement quality (filter dispersion) Similar to Cristian, the oj for the smallest dj is taken (from 8 samples) Clock frequency adjustment according to drift rate, runs in interval of a second Time Middleware and Distributed Systems 23

Synchronization Modes Multicast For high-speed LAN, receiving servers assume small delay of a few milliseconds Server announces time, but does not accept NTP messages Procedure call Server in client mode is willing to be synchronized, but offers no service For LAN s without multicast or demand for higher accuracy Symmetric Active mode for high-stratum servers, with pre-configured peers Passive mode for low-stratum servers and large number of peers Time Middleware and Distributed Systems 24

Data Formats in NTP NTP timestamp: 64bit unsigned fixed-point number Number of standard seconds since 1.1.1900, relative to UTC Precision of 232 picoseconds 1968, the most significant bit has been set - overflow in 2036 Leap indicator: 00 no warning, 01 last minute has 61 seconds, 10 last minute has 59 seconds Precision of the local clock, roundtrip delay to primary reference source, maximum error to primary reference source Reference clock identifier Stratum 2 or greater - IP address of reference clock; otherwise special tag (e.g. ATOM or GPS) Time Middleware and Distributed Systems 25

NTP Protocol Local time the local clock was last set or corrected Time the request departed Time the request arrived Time the reply departed NTP protocol header and timestamp formats Cryptosum NTP Protocol Header Format (32 bits) LI VN Mode Strat Root Delay Poll Root Dispersion Reference Identifier Reference Timestamp (64) Originate Timestamp (64) Receive Timestamp (64) Transmit Timestamp (64) Extension Field 1 (optional) Prec Extension Field 2 (optional) LI leap warning indicator VN version number (4) Strat stratum (0-15) Poll poll interval (log2) Prec precision (log2) NTP Timestamp Format (64 bits) Seconds (32) Fraction (32) Value is in seconds and fraction since 0 h 1 January 1900 NTPv4 Extension Field Field Length Field Type Extension Field (padded to 32-bit boundary) Last field padded to 64-bit boundary (C) David Mills 2004 Authenticator (Optional) Key/Algorithm Identifier Message Hash (64 or 128) NTP v3 and v4 NTP v4 only authentication only Authenticator uses DES-CBC or MD5 cryptosum of NTP header plus extension fields (NTPv4) Time Middleware and Distributed Systems 26

NTP Robustness Peer is considered unreachable if 8 poll intervalls fail Originate timestamp as one-time pad Should somehow match to transmit timestamp of last message Longest poll intervals must be consistent with required accuracy Poll interval is increased from minute to about 17 minutes, as long as filter dispersion is below an experimentally determined threshold Consistency algorithm for NTP peer selection (to find most reliable clock from a population) Highest reliability = lowest stratum and lowest synchronization distance (sum of total roundtrip delays to the synchronization root) Time Middleware and Distributed Systems 27