Subject: Re: NetBSD 2 vs the rest with MySQL
To: SODA Noriyuki <soda@sra.co.jp>
From: Chuck Silvers <chuq@chuq.com>
List: tech-perform
Date: 02/15/2005 09:34:56
On Fri, Feb 11, 2005 at 08:49:50AM +0900, SODA Noriyuki wrote:
> >>>>> On Wed, 09 Feb 2005 23:53:56 +0100,
> 	Pavel Cahyna <pavel.cahyna@st.mff.cuni.cz> said:
> 
> >>> Um, have you looked at the 10M Row test?
> >>> http://www.newsforge.com/blob.pl?id=82311a9e7896a841032c395f270d6a0f
> >>> Why so we not kick ass there at all?
> 
> > But, doesn't NetBSD need to read data to cache when they are rewritten,
> > since UBC was introduced? Could this explain that behaviour?
> 
> This sounds right, indeed.
> 
> Isn't anyone working to implement chuq's idea?
> 
> http://mail-index.netbsd.org/tech-kern/2003/05/27/0000.html


well, the reason I haven't done it myself yet is that it'll be a fair bit
of work to implement.  but it occurs to me that there's an easier way to
achieve most of the same effect:  use UVM loaning instead of uiomove()
to transfer the data in write().  this would be a bit more restricted
than what I described earlier, since it would require that the address
of the memory being written to the file be page aligned (whereas there's
no restriction on the memory address in the previous scheme), but I bet
that many applications that do multi-page write()s will happen to be using
page-aligned memory addresses as well.  I verified that this is the case
for mysql, at least in the default configuration.

the past few days I've been finishing my code for loaning-for-read()
that I've been infrequently fiddling with for probably a couple years now,
I'll post about it on tech-kern shortly.  loaning for write() shouldn't
be much harder than for read().

I suspect that in addition to loaning-for-write() we would also need to
improve the flush-behind and page reuse policies some more, but we'll
find out if we go down that path.

(of course, what databases that do their own caching really want is
unbuffered I/O, but mysql appears to rely on the OS file cache since
the mysqld process is only 60MB on this machine with 3GB of RAM.
maybe that's just how it's configured by default, I don't know much
about mysql.  unbuffered I/O would also be a fair bit of work to
implement, but I'd like to see that in netbsd eventually.)

-Chuck