apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <...@covalent.net>
Subject Re: apr_buckets_file.c:file_read + XTHREAD
Date Wed, 28 Nov 2001 06:00:21 GMT
On Tuesday 27 November 2001 09:39 pm, Cliff Woolley wrote:
> On Tue, 27 Nov 2001, Ryan Bloom wrote:
> > Bill's idea was to map and then unmap the individual sections of the
> > file, so that no more than one section was mapped at a time.  If you
> > do that, and you really unmap each section as you map the next, you
> > will be thrashing your MMAPs.  If you are really going to leave each
> > section as an MMAP, then I would agree completely, and say let's do
> > it, but that wasn't what Bill suggested.
> It might not be exactly what he said, but I thought it's what he _meant_.
> Ahh, don't you love the expressiveness of email?  :-)  One at a time is
> typically what you get with the code I posted anyhow since most filters
> limit how much they'll buffer, but the one-at-a-time rule is just not
> enforced.  If it were enforced, then oh yeah, that would be bad.  :)

The problem is the pathological case for the content-length filter, where it
absolutely REQUIRES a content-length.  If you put that filter after the
SSI filter, and we map and unmap, you will have problems.  While I agree
that in the general case mapping and unmapping is fine, I am most concerned
about the pathological case that we only hit once every few years, because
that is the case that will bite us in the ass.  :-)

I remember one lesson REALLY well from my time at IBM.  I worked next
to one of the guys working on the IBM proxy server, and he told me a story
about one of the web server developers who had moved on years before.
The guy wrote a block of threaded code that had a tiny race condition. He
did all of the math, and he found out that in the pathological case, the race 
condition was thousandths of a second.  He theorized that they would never
actually see the race condition, so it was safe to leave it in.  Wouldn't you
know it, the code never got out of QA.  When you put any kind of real stress
on the server, the race condition was hit.

Always worry about the pathological case when you write the code, it will
happen at least once.  :-)

Ryan Bloom				rbb@apache.org
Covalent Technologies			rbb@covalent.net

View raw message