• No results found

Implementing a NTP Based Time Service within a Distributed Brokering System

N/A
N/A
Protected

Academic year: 2020

Share "Implementing a NTP Based Time Service within a Distributed Brokering System"

Copied!
20
0
0

Loading.... (view fulltext now)

Full text

(1)

Implementing a NTP-Based

Time Service within a

Distributed Middleware

System

ACM International Conference on the Principles

and Practice of Programming in Java (PPPJ `04)

(2)

Motivation

n Collaboration environments make use of distributed

middleware systems to achieve collaboration among people geographically distributed.

n Time ordering of events generated by entities within a

distributed infrastructure is far more difficult than time ordering of events generated by a group of entities having access to the same underlying clock.

n The Network Time Protocol has been around for more than a

decade and being used in the Internet to let people to

synchronize their computer clocks with atomic time servers clocks.

n So we would like to achieve time-ordering of events generated

(3)

Example Application

n An archiving system designed to archive the streams generated

in a audio/video conferencing session(s)

n In a collaboration session, streams from these sources need to

be synchronized for archival and replay purposes.

n Real-time constraints for audio/video conferencing

applications can vary anytime between 30-100 msec, depending on the jitter and in inter-packet arrivals.

n In a distributed event brokering environment, RTP packets are

considered as events.

n Time-ordering of these events are necessary to achieve an

(4)

Computer Clocks I

n Computer timers keep time by using a quartz crystal and a

counter.

n Two types of clocks on a computer: hardware and software.

n What causes computer clocks get out of sync?

n run at different rates n manufacturing defects

n environment: temperature change, electric and magnetic interference n CPU load

n ill-behaved program

(5)

Computer Clocks II

n darya.ucs.indiana.edu - Wed Mar 17 18:29:13 EST 2004

(6)

Approaches to Order Events and

Synchronize Clocks

n Approaches can be divided into two categories: software (SW)

and hardware (HW)

n Logical timestamps (SW)

n Lamport timestamps n Vector clocks

n Synchronizing system clocks (SW)

n Cristian’s algorithm n Berkeley algorithm

n Averaging algorithms (decentralized algorithms)

n Network Time Interface (NTI) M-Module – custom VLSI chip

(7)

Network Time Protocol (NTP)

n NTP is used to synchronize timekeeping among a set of

distributed time servers and clients.

n Formal specification for version 3 can be found in RFC-1305

http://www.ietf.org/rfc/rfc1305.txt

n It defines the architectures, algorithms, entities and protocols

used by NTP.

n NTP is built on UDP/IP, which provides a connectionless

(8)

NTP (con’t)

n Stratum number is an integer indicating the distance from the

reference clock.

n Primary reference sources are synchronized by wire or radio.

Atomic time clock (Stratum-0)

Stratum-1 time servers

(9)

NTP (con’t)

Roundtrip delay (δ) and offset (Ө ) can be computed as follows

n Roundtrip delay (δ) δ = (T4 - T1) - (T3 - T2)

n Offset (Ө) Ө = [(T - T ) + (T - T )] /2

T1 T4

B

A

T2 T3

tAB tBA

n A: Client B: Time Server

n Transmission time from A to B

(tAB) is tAB = T2 – T1

n Transmission time from A to B

(10)

NaradaBrokering (NB)

n An event brokering middleware. Java Message Service (JMS)

compliant

n Supports publish-subscribe messaging model with a dynamic

collection of brokers.

n Provides services for TCP, UDP, Multicast, SSL, HTTP,

HTTPS, raw RTP clients and storage services - SQL and file based.

n Supports audio-video conferencing, communication through

firewalls and proxies, software multicast. n Publish/subscribe of A/V

n A A/V stream is regarded as a “topic” and each RTP packet from this

stream is regarded as an “event” for this topic.

n Only the sender of this stream can “publish” A/V events to this topic.

Other endpoints need to subscribe to this topic in order to receive the stream.

(11)

NB Time Service

n NB Time Service runs in the kernel of NaradaBrokering.

n There are two important parameters

n Number of time servers

n Time interval that the NB Time Service should run

n A number of time servers can be specified. There is no

restriction.

n By default, NB Time Service uses 8 stratum-1 time servers

(12)

NB Time Service (con’t)

n Unlike NTP daemons, NB Time Service does not change

underlying system clock. Because

n changing underlying system clock requires administrator privileges n the objective of this time service is to provide a mechanism to be able

to time-order the events generated within NaradaBrokering.

n Provides an interface, getTimestamp(), to get updated time in

milliseconds.

n Entities generating events in the system should utilize Time

(13)

NB Time Service (con’t)

sample 1 sample 2 sample n Phase 1: collecting samples Phase 2:

filtering & adding to the queue

1 2 m

offset1 1

W A

Phase 3:

establishing candidate list & computing offset

1 2 m

1 2 m

k LocalTime BaseTime BaseTime adjusted time Ne twork offset2

(14)

NB Time Service (con’t)

n Phase 1: Getting samples from NTP time servers.

n NTP messages are sent to the time servers provided one by one.

n UDP connection is used to send these messages and the timeout is set

to 500 ms.

n Phase 2: Filtering and adding to the queue.

n Timestamps are checked to validate the received NTP reply message. n For each time server a separate queue is provided to keep the previous

(15)

NB Time Service (con’t)

n Phase 3: Selection and combine algorithms.

n Using clustering algorithms a candidate list is constructed.

n Clustering algorithm uses synchronization distance related to each time

server to find the candidate list. It is a parameter computed from roundtrip delay and dispersion.

n Updating Offset

n Calculating offset as described is not sufficient to achieve

time-ordering of events.

(16)

Test Results I

n ntpd daemon is running and it synchronizes its time with

“time.nist.gov” time server.

(17)

Test Results II

n The first offset value is -139895 ms, which shows how much

the clock in that machine is ahead of the real time.

(18)

Inter Client Discrepancy

n tAB and tBA can be ignored if roundtrip delay is very small. n If tAB and tBA are ignored (or if they are approximately equal

to each other), the discrepancy (∆T) between these two clocks can be approximated as

∆T=0.5*(T2+T3-T1-T4)

n Client discrepancy measures

how much clocks of these clients are consistent with each other.

T1 T4

B

A

T2 T3

(19)

Inter Client Discrepancy (con’t)

Test duration is 143 minutes

Absolute maximum discrepancy is 2 msec Absolute minimum discrepancy is 0 msec

(20)

Conclusion

n Different machines with different platforms and with different

loads may have different clock rates which in time would get out of sync.

n One cannot rely on the underlying clock and use the system

clock to timestamp the events generated in messaging systems.

n Real-time constraints for collaboration environments is around

100 msec. NTP provides a sufficient synchronization range for such a collaboration environment.

n Stratum-1 servers should be chosen so that the roundtrip time

between time servers and the local machine is minimized.

n A Buffering Service has been implemented for

References

Related documents

 Make the best out of Google Analytics by leveraging Keley Consulting experience  Save time  Implement advanced features (for instance: newsletters monitoring, A/B

You should also be aware that if you wish to specify a local user in the Username field, you should enclose it in square brackets to let IceWarp Server know it should check its

In this paper, to operate a sensorless BLDC motor, we developed a new estimation system for rotor speed and rotor position speed using an ensemble Kalman filter

Ranging widely from research to academic studies to community education, these grants support the mission of Otterbein, enhance faculty achievement and student learning,

The distribution data in Figure 13 demonstrates that at least a year in advance, with production modules rather than champion modules, SSI accomplishments far exceed the 2003 DOE

TABLE V - Mean concentrations of curcuminoid pigments in pig ear skin (µg pigment/g skin) during in vitro skin permeation studies of different formulations containing curcumin

So make sure that you have adequately researched the market and know the market value of the position you are negotiating, not just for women in similar positions, but for both

It can be concluded that the velocity boundary layer thickness, the thermal boundary layer thickness, the surface gradient and the rate of heat transfer decrease as the suction