[ntp:questions] ntpd -q and driftfile

unruh unruh at wormhole.physics.ubc.ca
Tue Mar 22 19:03:58 UTC 2011

On 2011-03-22, Chris Albertson <albertson.chris at gmail.com> wrote:
> On Mon, Mar 21, 2011 at 11:38 PM, prashant sherin <pvsnmp at yahoo.com> wrote:
>> Hi,
>> I would like to know if ntpd would use the driftfile specified in /etc/
>> ntp.conf file if it is run periodically using crontab with -q option
>> as below:
> That is a rather resource intensive way to run NTP.   You use fewer
> CPU cycles just letting ntpd run in the background.   ntpd will decide
> all by itself that it can "sleep" once the clock is running well.
> The longer ntp has been running the longer these sleep periods tend to
> be.   It actually does more work when it starts up than after running
> for a few hours.   Placing it in the cron tab will force NTP to
> endlessly go through the hard work of staring up.
> You want a really bad car analogy?  To bad you get one anyway....
> Cars use most of their gas accelerating up to speed after stopping for
> a red light.   They use the least gas when cruising at steady speed of
> 35MPH.   Same with NTP by far most of the resources are used in the
> fist minute or so.  First off Cron has to create a shell process and
> that process creates an instances of NTP by loadingit's code from the
> disk into RAM, ntp then exchanges messages with other ntp servers at a
> relatively fast rate.  but after ntpd has been running for a few hours
> it has settled into doing almost nothing

The amount of work done by ntpd even when it is working hard ( on
startup) is completely trivial. This is like worrying about how much
the weight of your crisps packet contributes to the reduction in gas milage on your
car, while driving a V8 1/2ton truck. The cost of ntpd is completely
swamped by all kinds of other inefficiencies in your operating system.
(Of course if you are on a bicycle in the tour de France, it may be a
legitimate worry).

More information about the questions mailing list