mmap/write vs read/write supprise

Jim Nance (
10 Jul 1997 19:50:53 +0200

Hello all,
I read with interest yesterdays discussions of web server performance,
and I learned a lot. I decided to write a program last night that tested
the speed of doing I/O using the mmap/write vs the more traditional
read/write method. I will post the results and the source code later,
after I have enhanced/debugged it a little more, but my inital results
are a little supprising, so I thought I would share them with you.
At least with my test program, it seems like using the mmap/write
method shows the best performance gain when the file is small (ie 400 bytes).
As the file size grows, the performance gain decreases, and when the
file size get close to 1M, it becomes faster to use read/write rather
than mmap. This is with a 2.0.28 kernel on a Cyrix 6x68 P166+. I don't
have a stable 2.1.X kenel to test right now ;-)
Now these results are exactly the opposite of what I would expect.
I will post the source tomorrow, but I wanted to get this out now so that
people could tell me that I must be doing something wrong if this is
supposed to be impossible.