GEOM gcache の不思議な結果2008年04月19日 16時31分37秒

前回の gcache のキャッシュの結果を受けて、再調査をしてみた。前回の実験では、gcache にて作ったデバイスに対し dump を行なった。確かに実時間は半分になったが、ディスクアクセスが無くならなかった。キャッシュの大きさが 1GB なのに対し、デバイスの大きさが 2GB だった為に、キャッシュに乗り切らなかったのだろうと仮定した。そこで、今回は 1GB のデバイスを利用する。

/usr/src を GEOM uzip で固めている。そこが丁度、1GB のデバイスで、実際のファイルの大きさはそれよりも小さくなる。


# grep src /etc/fstab 
/dev/md.uzip            /usr/src        md      ro,-P,-F/usr/uzip/7.0-RELEASE+mount.uzip        0       0
# df -k /usr/src
Filesystem    1024-blocks   Used  Avail Capacity  Mounted on
/dev/md0.uzip      911262 542072 296290    65%    /usr/src

md0.uzip に対して gcache を行なう。


# gcache label -s 1g src /dev/md0.uzip 
Can't store metadata on /dev/md0.uzip: Operation not permitted.
gcache: Not fully done.
# gcache create -s 1g src /dev/md0.uzip
# ls /dev/cache/src 
/dev/cache/src

label を使うと gcache 情報を書き込み、create だと一回切りの様だ。uzip には書き込めないから label は失敗する。

dump をキャッシュに対して三回行なった後に、uzip にも行なってみた。


# time dump -f - -0 /dev/cache/src > /dev/null
  DUMP: Date of this level 0 dump: Fri Apr 18 09:21:05 2008
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/cache/src to standard output
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 551986 tape blocks.
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: DUMP: 551919 tape blocks
  DUMP: finished in 27 seconds, throughput 20441 KBytes/sec
  DUMP: DUMP IS DONE
1.174u 3.559s 0:28.31 16.6%     61+1141k 0+7io 0pf+0w
# time dump -f - -0 /dev/cache/src > /dev/null
...
1.283u 3.470s 0:27.94 17.0%     59+1099k 0+17io 0pf+0w
# time dump -f - -0 /dev/cache/src > /dev/null
...
1.227u 3.505s 0:27.93 16.8%     59+1111k 0+20io 0pf+0w
# time dump -f - -0 /dev/md0.uzip  > /dev/null
  DUMP: Date of this level 0 dump: Fri Apr 18 09:23:44 2008
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/md0.uzip to standard output
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 551986 tape blocks.
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: DUMP: 551919 tape blocks
  DUMP: finished in 67 seconds, throughput 8237 KBytes/sec
  DUMP: DUMP IS DONE
1.181u 3.824s 1:07.96 7.3%      63+1180k 0+12io 0pf+0w

今回、dump に掛かる時間は半分に短縮されている。しかし、systat -vmgstat -a で実行中に観察をしていると、沢山のディスクアクセスがある。

1GB のメモリが積んであって、この作業の後も 600MB 以上も未使用のままだ。md0.uzip 上の全てがキャッシュされていてもおかしくは無いのにである。


# top
last pid:  1230;  load averages:  0.00,  0.00,  0.03    up 0+00:42:57  09:42:05
65 processes:  1 running, 64 sleeping
CPU states:  0.2% user,  0.0% nice,  0.6% system,  0.4% interrupt, 98.9% idle
Mem: 69M Active, 30M Inact, 198M Wired, 1044K Cache, 72M Buf, 631M Free
Swap: 2048M Total, 2048M Free

また、計測のやり方を変えてキャッシュの結果を調べ直したい。

前回次回