Re: Removing time-hack?

From: Andres Kroonmaa <andre@dont-contact.us>
Date: Fri, 26 Jul 2002 10:49:49 +0300

 I submitted the patch some 4 years ago, and it got changed on the way.
 Its point was to stamp time only at places where its really needed, and
 arised from noticing that some systems read RTC hardware upon gettimeofday()
 which is awfully slow, or cause kernel switch with all scheduling overhead.
 This call was then used almost on every packet through squid, so it was
 kind of cpuhog. But modern OS'es are much more efficient and thus this is
 becoming irrelevant (it takes ~3K cputicks to run on Solaris, ~500 Linux).

 There are actually quite few places when we need to gettimeofday() between
 1sec updates, only where subsec precision is needed, basically only to
 measure precisely request service times, ie. at start of new request and at
 its end. Currently we do this per poll loop, and infact also error on time
 if many FDs are ready and it takes time to service them.

 As this hack is currenty implemented, it is useless, and in fact even bad.
 It disables "per-fd-event" stamping, but does not stamp time when its needed,
 resulting timestamps to be long way off reality.

 I would suggest to remove its ifdefs from comm_*.c files, but leave it in
 main.c There it creates a 1sec heartbeat that updates internal time
 every second. This is sometimes problem in squid, cache.log entries are
 sometimes stuck at last value of time and not updated during some longer
 blocking run. Such beat updates time reliably. not critical though.

 high cpu arises because internal time is updated _only_ once a second, and
 some parts of squid loop even uselessly until internal time changes. (poll
 loop will spin wildly in some cases) Removing ifdefs from comm* will solve
 this. Ideally we should add getCurrentTime() at just those places where its
 required, would also solve the issue, but thats more difficult job, alot of
 places to change. If you don't like alarm signal updating time in main.c,
 remove it completely, no big deal. I agree that as it is now, it should be
 removed from stable.

On 25 Jul 2002, at 22:44, Joe Cooper <joe@swelltech.com> wrote:

> Hi folks,
>
> Would it be useful for me to send a patch removing the
> --enable-time-hack option from Squid?
>
> I'm unsure of whether it works as intended on any OS (certainly not on
> Linux, and I think I've seen users of FreeBSD and Solaris report high
> CPU with it as well), or if anyone is fond of it for any reason.
>
> Anyway, if there are no objections, I'd love to see it either fixed or
> gone for 2.5STABLE. I can't fix it, but I can make it gone, if it is
> agreed that it ought to be gone.

------------------------------------
 Andres Kroonmaa <andre@online.ee>
 CTO, Microlink Online
 Tel: 6501 731, Fax: 6501 725
 Pärnu mnt. 158, Tallinn,
 11317 Estonia
Received on Fri Jul 26 2002 - 01:57:53 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:15:53 MST