Dir. cache suprise

Aaron Tiensivu (tiensivu@pilot.msu.edu)
Sun, 22 Dec 1996 18:01:20 -0500 (EST)


I have had some time to "play" with a couple of my projects that I'm working
on, so I spent part of today messing with various values of the default dir.
cache code in fs/dcache.c

I figured if I increased the number of entries, and the "max" width (since VFAT
filenames tend to be bigger than the default 15 characters) that I would get a
modest increase in performace.

Well, the overall "feel" of the system is much spunkier when using the last
values below. It went from 1143943 to 258092 in the 'dskcache' hit area. You
might think that is bad, but actually it is very good. The difference is how
many times the larger dir. cache avoided use of the buffer cache.

It doesn't look like dcache.c is very "dynamicable" without some good hard
hacking. I kind of want to be able to have DCACHE_NAME_LEN and DCACHE_SIZE
/proc tunable. I might mess around with it some more just for hack-value.

We may want to make the size be dynamically allocated depending upon how much
overall memory we have. I lose about 140k with the larger cache, but I like the
results.

The tests run below are fairly simple ones. It was done on a 1.7 Gig IBM
DeskStar EIDE hard-drive, with a 800MB VFAT partition, 800MB ext2 partition and
a 1/2-full CD-ROM mounted. Both 800MB partitions are almost completely full.

Commands:
Reboot, log into first console, "cd /", "time ls -R", "cat /proc/stat"

Linux pre-2.1.17:

DCACHE_NAME_LEN = 15 (default)
DCACHE_SIZE = 128 (default)

dircache 189048 18321
dskcache 1143943 32935
fatcache 40097 790

3.38user 51.51system 1:40.60elapsed 54%CPU
-------------------------------------------

DCACHE_NAME_LEN = 40
DCACHE_SIZE = 128 (default)

dircache 174178 12960
dskcache 918559 33288
fatcache 40097 790

3.67user 46.40system 1:35.50elapsed 52%CPU
-------------------------------------------

DCACHE_NAME_LEN = 15 (default)
DCACHE_SIZE = 1024

dircache 181711 5411
dskcache 447647 33232
fatcache 1022 790

3.34user 32.50system 1:20.92elapsed 44%CPU
-------------------------------------------

DCACHE_NAME_LEN = 40
DCACHE_SIZE = 1024

dircache 205475 1907
dskcache 258092 33033
fatcache 1022 790

3.41user 27.22system 1:15.44elapsed 40%CPU
-------------------------------------------

If someone wants to get super-anal about it, they could do some kernel
profiling to see how much of a difference it makes.

---
Which is worse: ignorance or apathy?  Who knows?  Who cares?
Life is sexually transmitted.
Disco is to music what Etch-A-Sketch is to art.