Date: Tue, 14 Jan 2003 14:30:15 +0300 (MSK) From: Igor Sysoev <is@rambler-co.ru> To: Terry Lambert <tlambert2@mindspring.com> Cc: arch@FreeBSD.ORG Subject: Re: getsysfd() patch #1 (Re: Virtual memory question) Message-ID: <Pine.BSF.4.21.0301141429390.26727-100000@is> In-Reply-To: <3E23ED80.5C5832BC@mindspring.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 14 Jan 2003, Terry Lambert wrote: > Igor Sysoev wrote: > > Nevetheless it seems to me that using many kernel timers is not good > > thing if you need frequently to set or delete them (i.e. in web-servers). > > It's much better to use user-level timer queue and call > > kqueue/poll/select with timeout value from the head of this queue. > > This is actually a bogus argument against it. It turns out that I do not want to say that kernel-based timers are useless or too expensive. I only want to say that if application need to set and delete timers too often then it's much better to set and delete them in user space because most of them will never fired and calling kernel to set or cancel them is expensive. > for timers, they work better if they are cancelled before they > ever fire, because cancellation is by reference, whereas firing > is by traversal. In server that I'm deleloping I use delta value between timeouts so firing is cheap as cancelation. Firing timers are on the head of queue. > In any case, it's much more bogus to argue against timers that > never fire, than it is to argue against timers that do fire -- > the 2MSL timers used everywhere in the TCP stack are actually > timers that, in the common case, never actually fire. If you > want to argue against non-firing timers, you'd need to revert > the change to the TCP stack that moved it to the callout wheel > based timers, back in the mid/late 1990's. I did not argue against previous, current or future implementation of timers in the kernel. I mean that if user-level application need to set thousands timers (i.e. web server with thousands connections) it's better to manage them in user space and set only one the most early timer in the kernel via kqueue/select/poll. Igor Sysoev http://sysoev.ru/en/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0301141429390.26727-100000>