From owner-freebsd-hackers Tue Feb 19 10: 5:12 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from host213-123-131-110.in-addr.btopenworld.com (host213-123-131-110.in-addr.btopenworld.com [213.123.131.110]) by hub.freebsd.org (Postfix) with ESMTP id 1477737B416 for ; Tue, 19 Feb 2002 10:05:05 -0800 (PST) Received: by host213-123-131-110.in-addr.btopenworld.com (Postfix, from userid 1001) id 905EA541; Tue, 19 Feb 2002 18:05:46 +0000 (GMT) Date: Tue, 19 Feb 2002 18:05:46 +0000 From: Dominic Marks To: Alfred Perlstein Cc: Kip Macy , Peter Wemm , Mike Silbersack , Hiten Pandya , freebsd-hackers@FreeBSD.ORG Subject: Re: In-Kernel HTTP Server (name preference) Message-ID: <20020219180546.B12535@host213-123-131-110.in-addr.bto> References: <20020219092058.A78717@host213-123-131-110.in-addr.bto> <20020219175431.A12535@host213-123-131-110.in-addr.bto> <20020219180004.GO12136@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020219180004.GO12136@elvis.mu.org>; from bright@mu.org on Tue, Feb 19, 2002 at 10:00:04AM -0800 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, Feb 19, 2002 at 10:00:04AM -0800, Alfred Perlstein wrote: > * Dominic Marks [020219 09:53] wrote: > > Hey, > > > > On Tue, Feb 19, 2002 at 09:19:56AM -0800, Kip Macy wrote: > > > > Apache will switch to this method at some point. I really can't > > > > understand why they went with that complicated pre-forking stuff. > > > > Using non-blockijng I/O is just not that hard." > > > > > > As mentioned previously, due to the blocking semantics of file I/O on unix, > > > single process servers will only provide peak throughput if everything is > > > resident. By pre-forking, data can continued to be served if one process blocks > > > on file I/O. Apache already handles multiple connections within a process, so > > > it does something like this already. > > > > Yes.. but if your using non-blocking IO for both the disc and network > > read/writes, this no longer applies. If I understand correctly in > > normal operation a server like tHttpd simply blocks on kevent() and > > when a descriptor becomes available for servicing it handles this > > occurance, or occurances since a single kevent() call can return more > > than a single event and then goes back to blocking. Reads and writes > > don't block if they don't complete, you simply get another event when > > the descriptor becomes available again. > > > > Am I wrong? > > Yes, you are wrong. > > Disk IO can't be done in a non-blocking manner. If the kernel doesn't > have the portion of the file you wish to read in the buffer cache > then the process will block waiting. There is simply nothing you > can do about this other than to offload that blocking into another > process context via kernel threads, posix aio or kses. > Thanks for the lesson! > -- > -Alfred Perlstein [alfred@freebsd.org] > 'Instead of asking why a piece of software is using "1970s technology," > start asking why software is ignoring 30 years of accumulated wisdom.' > Tax deductible donations for FreeBSD: http://www.freebsdfoundation.org/ -- Dominic To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message