mmap() versus read()

Dean Gaudet (
Thu, 5 Mar 1998 18:15:39 -0800 (PST)

Apache 1.3 uses mmap() for all files. 'cause folks wanted that feature.
And it does cook, when there's enough RAM. But what I'm seeing right now
is that when RAM is tight it's not a win. For example you've got a 80Mb
mirror of the latest craze animated short "troops" on your machine, along
with a 35Mb MUD, and 15 regular users reading email in pine... and you've
got only 128Mb of RAM.

The box is a dual pentium-133 running 2.0.32.

When I'm using apache/mmap to serve the files, if I run "vmstat 1" I see
continual swap-in events, to the tune of 30 per second, with around the
same number of "block in". There are occasional swap-out events too.
Not that many... but the system is noticeably lagging on interactive

When I try using wu.ftpd, which doesn't mmap, I see "block-in" events
in the 400 per second range, and no swap activity. The system is still
very responsive to interactive traffic.

The outgoing bandwidth is almost the same in both cases -- it's in the
500Kbyte/s, 500 packet/s range. (Measured with ip accounting.)

So is this expected? Is there a knob I can twist? Is this just 2.0.32
buffer problems and would be fixed by 2.0.33?

FYI, Apache 1.3 write()s from a mmap()d range in 32k chunks. wu.ftpd is
read()ing and write()ing 8k chunks.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to