Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Oct 2003 16:35:52 -0700
From:      Luigi Rizzo <rizzo@icir.org>
To:        "akanwar@digitarchy.com" <akanwar@digitarchy.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: HZ = 1000 slows down application
Message-ID:  <20031007163552.A92652@xorpc.icir.org>
In-Reply-To: <410-22003102722174477@M2W077.mail2web.com>; from akanwar@digitarchy.com on Tue, Oct 07, 2003 at 06:17:04PM -0400
References:  <410-22003102722174477@M2W077.mail2web.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Oct 07, 2003 at 06:17:04PM -0400, akanwar@digitarchy.com wrote:
> Hi Luigi, Mark,
> 
> Thanks for your replies.
> 
> We did some intensive profiling of our application. It does not seem like
> we are depending on clock ticks for any calculations.
> 
> On the other hand we notice that our slow iterations happen almost at the
> same instant as "microuptime went backward" messages in the system log. We

if this is the case, probably your code at some point computes a
time difference which turns out negative (or if it is unsigned, it
becomes very very large) upon those events, thus causing some loop
to explode.
It should be easy to check if this is the case, and just ignore
those outliers rather than trying to figure out why the clock
goes backward. I used to see the same "microuptime went backwards"
msg on some of my 400MHz boxes, even without NTP enabled.
Maybe a buggy timer, not sure which timecounter was used on that
box (i read some time ago that the cpu on the soekris4801 has a
weird TSC implementation where the upper 32 bits change when the
lower 32 bits are 0xfffffffd, who knows what other bugs might be
in other hardware...)

	cheers
	luigi

> were told that ntpd is correcting the time when these messages appear. The
> vexing problem is that making HZ=1000 has increased the rate at which ntp
> updates the time. Is this possible ? Does ntp count the number of ticks
> before applying a correction ?
> 
> This is the point we are at now. Any help to shed more light on this is
> appreciated.
> 
> Thanks,
> -ansh
> 
> 
> 
> 
> 
> Original Message:
> -----------------
> From: Mark Santcroos marks@ripe.net
> Date: Tue, 7 Oct 2003 19:16:14 +0200
> To: akanwar@digitarchy.com
> Subject: Re: HZ = 1000 slows down application
> 
> 
> On Mon, Sep 22, 2003 at 02:22:02PM -0700, Luigi Rizzo wrote:
> > On Mon, Sep 22, 2003 at 02:43:40PM -0400, akanwar@digitarchy.com wrote:
> > ...
> > > But now I noticed that my application is occassionally doing slower
> > > iterations. Average iteration time used to be 0.2 ms without polling
> > > enabled. With the device polling changes, the average time is still
> around
> > > the same, but once every few minutes the application sees iterations
> that
> > > are 3.3 seconds (*seconds*, not a typo) long. 
> > 
> > most likely your application makes some assumptions on the duration of
> > a clock tick and then it gets confused when, say, a select returns
> > quicker, or some time difference becomes negative, etc. etc. because
> > of the finer granularity.
> > 
> > very common type of bug.
> 
> Hi,
> 
> What was the outcome of this?
> 
> Thanks
> 
> Mark
> 
> 
> 
> 
> --------------------------------------------------------------------
> mail2web - Check your email from the web at
> http://mail2web.com/ .
> 
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031007163552.A92652>