[ntp:questions] Need suggestion on compensating clock drift on Xen based VPS

Aryanto Rachmad aryanto at chello.at
Sat Aug 22 20:28:36 UTC 2009


Hello everybody,

I am trying to have a stable system clock on my Xen based VPS, so I 
installed ntpd. When I used ntpdate once a day, I noticed that the drift 
is quite a lot. So after I use ntpd, based on the output on the syslog, 
it seems that my system clock is drifting for about 2.3 seconds in 16 
minutes as below:

Aug 22 19:14:59 myvhost ntpd[3688]: time reset +2.431644 s
Aug 22 19:15:28 myvhost ntpd[3688]: synchronized to 213.239.214.170, 
stratum 2
Aug 22 19:15:54 myvhost ntpd[3688]: synchronized to 213.133.108.253, 
stratum 2
Aug 22 19:16:42 myvhost ntpd[3688]: synchronized to 213.9.73.106, stratum 2
Aug 22 19:30:45 myvhost ntpd[3688]: time reset +2.314923 s
Aug 22 19:31:01 myvhost ntpd[3688]: synchronized to 213.9.73.106, stratum 2
Aug 22 19:31:43 myvhost ntpd[3688]: synchronized to 213.239.195.212, 
stratum 2
Aug 22 19:32:15 myvhost ntpd[3688]: synchronized to 213.9.73.106, stratum 2
Aug 22 19:46:06 myvhost ntpd[3688]: time reset +2.275680 s
Aug 22 19:46:41 myvhost ntpd[3688]: synchronized to 213.9.73.106, stratum 2
Aug 22 19:47:17 myvhost ntpd[3688]: synchronized to 213.133.108.253, 
stratum 2
Aug 22 19:48:04 myvhost ntpd[3688]: synchronized to 213.239.195.212, 
stratum 2
Aug 22 19:48:12 myvhost ntpd[3688]: synchronized to 213.9.73.106, stratum 2

 From what I understood, ntp is used to compensate the drifting instead 
of changing the clock as ntpdate does, which makes the system clock 
jumps. But when I run the following command, I can see that ntp is doing 
the same as ntpdate:

# while true; do date; sleep 1; done
.
.
Sat Aug 22 19:30:41 CEST 2009
Sat Aug 22 19:30:42 CEST 2009
Sat Aug 22 19:30:46 CEST 2009 <-- jumps 4 seconds
Sat Aug 22 19:30:47 CEST 2009
Sat Aug 22 19:30:48 CEST 2009
.
.
Sat Aug 22 19:46:02 CEST 2009
Sat Aug 22 19:46:03 CEST 2009
Sat Aug 22 19:46:06 CEST 2009 <-- jumps 3 seconds
Sat Aug 22 19:46:07 CEST 2009
Sat Aug 22 19:46:08 CEST 2009
.
.

I think the only way to prevent this kind of jumping clock affect, is to 
adjust the kernel clock tick and frequency. On my server at home, I can 
do that using the adjtimex. But on my VPS, I can not because I don't 
have /dev/rtc or any rtc device. Is there any way to compensate the 
clock tick and frequency without having /dev/rtc?

I know that it is problematic to run ntpd on Xen domU, but could anybody 
give me some suggestion to have a stable system clock?

FYI, the only settings that I have tried are the followings:

myvhost:~# cat /proc/sys/xen/independent_wallclock
1
myvhost:~# cat 
/sys/devices/system/clocksource/clocksource0/current_clocksource
jiffies

Thanks a lot in advance for your help.

Kind regards,

Anto





More information about the questions mailing list